Skip to content

Instantly share code, notes, and snippets.

@rpearl
rpearl / command.sh
Created March 27, 2020 18:11
list of US shelter-in-place orders for covid-19
curl --data-urlencode query@query.sparql 'https://query.wikidata.org/sparql?format=json'
@rpearl
rpearl / fix-author.sh
Created February 6, 2017 19:07
template of a script to fix incorrect git author information
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
import sys
voicemap = str.maketrans({
'g': u'k\u3099',
'G': u'K\u3099',
'z': u's\u3099',
'Z': u'S\u3099',
'd': u't\u3099',
'D': u'T\u3099',
'b': u'h\u3099',
#include <FastLED.h>
#define NUM_LEDS 197
#define RANDOM 0
#define IN_ORDER 1
CRGB leds[NUM_LEDS];
// 1, 2
// 'Firewalker' LED sneakers sketch for Adafruit NeoPixels by Phillip Burgess
#include <Adafruit_NeoPixel.h>
const uint8_t gamma[] PROGMEM = { // Gamma correction table for LED brightness
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5, 5,
5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 9, 9, 9, 10,

Keybase proof

I hereby claim:

  • I am rpearl on github.
  • I am rpearl (https://keybase.io/rpearl) on keybase.
  • I have a public key whose fingerprint is 0B4B 61D8 BF12 5AB9 D5BD FC9C 9C41 D452 9159 A603

To claim this, I am signing this object:

@rpearl
rpearl / fixrange.sml
Created September 20, 2012 15:30
Getting around stupid constraints
(* 03:40 < Oejet> How would you implement f n = [1, ..., n], using only map, or
foldl?
*)
fun range n = foldl (op ::) [] (
(fn fix => fix (fn f => fn n => case n of 0 => [] | n => n::f (n-1)))
(
fn f =>
(fn cell =>
(fn f' => (fn () => f')(cell := SOME f')
@rpearl
rpearl / undefined.c
Created August 8, 2012 05:38
Compile with gcc on -O2.
#include <stdio.h>
#include <limits.h>
int foo(int x) {
return (x+1) > x;
}
int main(void) {
printf("%d\n", (INT_MAX+1) > INT_MAX);
printf("%d\n", foo(INT_MAX));
@rpearl
rpearl / uninit.c
Created June 11, 2012 13:04
Uninitialized variables? Who needs warnings!
#include <stdio.h>
void foo(int bar);
void foo(int bar) {
int lol;
if (bar) {
lol = 7;
}