Skip to content

Instantly share code, notes, and snippets.

@phooky
phooky / no_masters.sh
Last active Dec 16, 2020
A quick bash script for changing the "master" branch of your github repo(s) to an alternative of your choosing.
View no_masters.sh
#!/bin/bash
# There's a better way to do this! Use:
# https://github.com/dfm/rename-github-default-branch
# instead.
#
# Also: don't change the default branch name on your gists! Github appears to have them
# locked to master; it will break your gist.
set -e
@phooky
phooky / randomorganelle.py
Created Nov 6, 2019
terrible fm synthesis, it's just awful
View randomorganelle.py
#!/usr/bin/python3
import wave
import sys
import struct
import math
outpath=sys.argv[0].rsplit('.',1)[0]+".wav"
print("Writing to {}".format(outpath))
View keybase.md

Keybase proof

I hereby claim:

  • I am phooky on github.
  • I am phooky (https://keybase.io/phooky) on keybase.
  • I have a public key whose fingerprint is 8D02 E4ED 9CB7 9E1D 739A A5AE 2811 F88B 2064 A861

To claim this, I am signing this object:

@phooky
phooky / clone_repos.py
Created Nov 9, 2012
A quick script for cloning all the githup repositories for your user. Requires the github3 package; install with "pip install github3"
View clone_repos.py
#!/usr/bin/python
from github3 import authorize, login
from getpass import getuser, getpass
from os.path import exists, expanduser
from subprocess import Popen
CREDENTIALS_PATH = expanduser('~/.clone_repo.token')
def cloneAllRepos(gh):
@phooky
phooky / moore.py
Created Feb 6, 2012
That thing for the dragon curve? Yeah, again, but for the moore curve.
View moore.py
#!/usr/bin/python
from itertools import chain
import sdxf
from math import sin,cos,pi
axiom = list("LFL+F+LFL")
rules = { 'L' : list("-RF+LFL+FR-"),
'R' : list("+LF-RFR-FL+") }
@phooky
phooky / dragon.py
Created Jan 25, 2012
Script for generating a dragon curve in dxf format; requires sdxf.
View dragon.py
#!/usr/bin/python
import sdxf
from math import sqrt, sin, cos, pi
iterations = 11
def move(pos,angle,distance):
nx = pos[0] + sin(angle)*distance
ny = pos[1] + cos(angle)*distance
@phooky
phooky / git-wrapper.sh
Created Jan 5, 2012
A simple wrapper script for git that tracks cloned repositories and implements "git pull-all" to do a git pull in each such repository.
View git-wrapper.sh
#!/bin/sh
#
# Git wrapper for tracking cloned repositories and implementing
# "pull-all" to update all cloned repositories from their origins.
#
# Add the following to your bashrc to enable:
# alias git=/PATH/TO/git-wrapper.sh
# Todo: parse out options to clone to avoid completely messing up
View hexgen.py
#!/usr/bin/env python
# Here's a useful skeleton for generating (in this case) an intel hex file
# for filling size bytes with 0xff; it can be easily modified to convert
# bytes from stdin.
size = 0x200
offset = 0
blocksize = 16