Skip to content

Instantly share code, notes, and snippets.

@jefffriesen
jefffriesen / README.md
Last active May 2, 2024 15:11
US Zip Codes

This is a d3.js visualization of US zip codes.

Original zip code dataset from Geocommons.

5MB shapefile with properties such as zipcode, state, name, population, area, more.

http://geocommons.com/overlays/54893 (Thank you Bill Greer)

This converts it nicely:

@shafik
shafik / WhatIsStrictAliasingAndWhyDoWeCare.md
Last active May 2, 2024 15:08
What is Strict Aliasing and Why do we Care?

What is the Strict Aliasing Rule and Why do we care?

(OR Type Punning, Undefined Behavior and Alignment, Oh My!)

What is strict aliasing? First we will describe what is aliasing and then we can learn what being strict about it means.

In C and C++ aliasing has to do with what expression types we are allowed to access stored values through. In both C and C++ the standard specifies which expression types are allowed to alias which types. The compiler and optimizer are allowed to assume we follow the aliasing rules strictly, hence the term strict aliasing rule. If we attempt to access a value using a type not allowed it is classified as undefined behavior(UB). Once we have undefined behavior all bets are off, the results of our program are no longer reliable.

Unfortunately with strict aliasing violations, we will often obtain the results we expect, leaving the possibility the a future version of a compiler with a new optimization will break code we th

@tomasdev
tomasdev / minecraft-emoji.md
Last active May 2, 2024 15:06
Minecraft allowed emojis

Minecraft allowed emojis

Ever wondered how to insert emoji in minecraft? Well turns out Minecraft supports only a subset of emoji (old one) but you can copy-paste these in it!

Screenshot of the emojis being rendered in Minecraft

These also look great on signs!

Minecraft sign with glowing effect showcasing arrows

@benclmnt
benclmnt / advice.md
Last active May 2, 2024 15:05
NUS CS Planning

Module Planning

Here be some of my notes on how to plan your CS career (specifically NUS).

First things first, I encourage you to have your own module plan (say, in a Google Sheets). You can start with the suggested module plan, but they are quite generic and might not suit your personal goals (e.g. some advanced modules you'd like to take have prerequisites that are offered in odd semesters only).

Having your own module plan will also make you easier to include other non-academic activities too.

General advice

  • Take as many foundational (core) modules while you can. You never want to be left behind due to missing prerequisites.
@tkfu
tkfu / srd_5e_monsters.json
Last active May 2, 2024 15:04
A JSON file with all the D&D 5e SRD monster data
[
{
"name": "Aboleth",
"meta": "Large aberration, lawful evil",
"Armor Class": "17 (Natural Armor)",
"Hit Points": "135 (18d10 + 36)",
"Speed": "10 ft., swim 40 ft. ",
"STR": "21",
"STR_mod": "(+5)",
"DEX": "9",

What are mixins?

Mixins are a way to inject code or change the minecraft source code directly and should be use with caution. If you can do a PR to Forge or use an event, try those first. If all else fails, then mixins may be a good option to look into. Here are some resources for mixins:

Now, I'll be honest, the official mixin doc is kind of terrible to learn from for most people. It's extremely dense and and really only helps people who already knows in-depth bytecode and stuff. But most modders aren't like that and just wants to do small stuff lol. But I'll give you the run-down here. There's a few kinds of mixins that you will encounter quite often.

@iamtraction
iamtraction / genTwitchAccessToken.sh
Created November 24, 2020 05:49
Generate Twitch Access Token. Usage: ./genTwitchAccessToken.sh CLIENT_ID CLIENT_SECRET
#!/bin/bash
#
# Usage:
# ./genTwitchAccessToken.sh CLIENT_ID CLIENT_SECRET
curl -X POST "https://id.twitch.tv/oauth2/token?client_id=$1&client_secret=$2&grant_type=client_credentials"
@zmts
zmts / tokens.md
Last active May 2, 2024 15:03
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
Me:
I am looking to build a simple GUI site that allows me to paste in some text, click "rewrite", and get rewritten, cleaned-up text back. This input text is ran through the Claude API to rewrite it. The GUI should be very simple. I just want a text box for input and a text box for output. I also two sliders on the side with labels on the ends:
Tone: casual on the left, formal on the right. The middle instructs the model to keep the tone/voice the same.
Length: shorter on the left, longer on the right.
Above these sliders, I want a model selector dropdown that let's me pick which Claude model to use. I also want a copy text button under the output textbox. The three Claude models are:
claude-3-opus-20240229. Display name "Claude 3 Opus".
claude-3-sonnet-20240229. Display name "Claude 3 Sonnet".
claude-3-haiku-20240307. Display name "Claude 3 Haiku".