Skip to content

Instantly share code, notes, and snippets.

Avatar
🍰
cupcake

Christopher Swenson swenson

🍰
cupcake
View GitHub Profile
@swenson
swenson / git-fanfic-setup.sh
Created Jun 12, 2020
Setup git fanfic aliases
View git-fanfic-setup.sh
#!/bin/sh
# thanks hanselman https://www.hanselman.com/blog/EasilyRenameYourGitDefaultBranchFromMasterToMain.aspx
git config --global alias.new '!git init && git symbolic-ref HEAD refs/heads/canon'
# https://twitter.com/tesseralis/status/1271197776886370305
git config --global alias.retcon 'rebase'
git config --global alias.op 'blame'
git config --global alias.clip-show 'log'
git config --global alias.fanfic 'branch'
@swenson
swenson / helloworld.bf
Created Jun 7, 2017
Hello World in BF, made in a diff with only line deletions
View helloworld.bf
+
+
+
+
+
+
+
+
[
>
@swenson
swenson / life.py
Last active Apr 27, 2017
Game of Life in Rust and Python
View life.py
from pprint import pprint
import random
def nextgen(state):
new_state = []
for i in range(5):
new_state.append([0] * 5)
for x in range(5):
@swenson
swenson / rlwe-integers.ipynb
Created Dec 24, 2016
This notebook performs computations from "Fully Homomorphic Encryption over the Integers" by van Dijk, Gentry, Halevi, and Vaikuntanathanm, which can be found at https://eprint.iacr.org/2009/616.pdf
View rlwe-integers.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@swenson
swenson / explore.py
Created Aug 10, 2016
Ctags + Pygments static source generator
View explore.py
from collections import defaultdict
import json
import os
import os.path
import shutil
from pygments.formatters import HtmlFormatter
from pygments.lexers import get_lexer_for_filename
from pygments import highlight
@swenson
swenson / segfault.py
Created Jul 13, 2016
Segfault Python 2.7.11 (mac) by adding numbers
View segfault.py
This file has been truncated, but you can view the full file.
def f():
a0 = 0
a1 = 1
a2 = 2
a3 = 3
a4 = 4
a5 = 5
a6 = 6
a7 = 7
@swenson
swenson / repro.chpl
Created Mar 28, 2016
Tuple destructor: formal count does not match argument count
View repro.chpl
proc f() : (int, int) {
return f();
}
proc main() {
f();
}
View repro.chpl
proc f() : (int, int) {
return f();
}
proc main() {
f();
}
@swenson
swenson / backup.sh
Created Aug 12, 2015
Install tarsnap. Then, here's some stuff.
View backup.sh
#!/bin/bash
NAME="something"
d=$(date "+%F--%H-%M-%S")
/usr/local/bin/tarsnap -c --keyfile /root/tarsnap.key --cachedir /usr/local/tarsnap-cache -f $NAME-backup-$d /etc /home /root /var
@swenson
swenson / debug.asm
Created Apr 25, 2015
A 6502 disassembler and debugger (written as part of a NES emulator)
View debug.asm
do_a_trap
mov esi, [trap]
test esi, 0x10000
jnz normal_trap
test esi, 0x20000
jnz register_trap
jmp near return_no_cigar
normal_trap
cmp si, [_PC]
jnz near return_no_cigar