Skip to content

Instantly share code, notes, and snippets.

@willm
willm / runOnStartup.sh
Last active August 29, 2015 14:23
run a script on startup ubuntu
#put this in /etc/init/service.conf, for more info, see http://upstart.ubuntu.com/
start on startup
task
setuid username # will be root if this is not specified
exec /path/to/command
@willm
willm / Supercollider cheat sheet
Last active August 29, 2015 14:22
Supercollider cheet sheet
//Create a synthdef
SynthDef(\name, { arg freq=440;
Out.ar([0,1], SinOsc.ar(freq, 0, Line.kr(0.5, 0, 0.5, doneAction:2)))
}).add;
Synth(\name, [\freq, 220]);
//Create a pattern
Pdef(\pattern,
Pbind(\instrument, \name, \dur, 0.15, \degree, Pseq([5, 3, 1], inf))
@willm
willm / serve-git-rep
Created May 12, 2015 13:41
serve a local git repo over http
git update-server-info
mv .git/hooks/post-update.sample .git/hooks/post-update
python -m SimpleHTTPServer
#in another shell
git clone http://localhost:8000/.git my-repo
cd my repo
@willm
willm / redis cheet sheet
Last active August 29, 2015 14:20
redis cheat sheet
flushall #deletes all
sentinel masters #lists the master redis instances
@willm
willm / docker cheat sheet
Last active August 29, 2015 14:18
docker cheat sheet
docker build -t [TAG] .
# build an image from a Dockerfile in the current directory with the tagname.
docker create --name=[NAME] [TAG]
# create a container called [NAME] built from the image [TAG]
docker start [NAME]
# start the [NAME] container
docker ps -a
# list all (running and stopped containers)
docker rm [NAME]
# delete [NAME] container
@willm
willm / convert-to-gif
Created December 19, 2014 15:22
convert list of images to animated gif
convert -delay 50 *.jpg -loop 0 output.gif
@willm
willm / serialize to csv
Last active August 29, 2015 14:04
Serialize objet to csv ServiceStack.Text
var csv = CsvSerializer.SerializeToCsv(new[]{
new Dog () {
Bark = "Woof!",
Male = true,
Size = 10
}});
@willm
willm / kill windows service
Last active August 29, 2015 14:01
killing a windows service stuck in stopping state
sc queryex {SERVICE_NAME}
::get the name from the properties in the ui
taskkill /PID {PID} /F
::get the pid from the output of the previous command
::Or more concisely
taskkill /F /FI "SERVICES eq {service-name}"
@willm
willm / find and grep
Last active August 29, 2015 13:57
grep results of find
find . -name filename -exec grep search {} \;
@willm
willm / tabs to spaces
Created January 13, 2014 00:17
converts all tabls to 4 spaces in all python files in the current directory
find . -name "*.py" ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;