This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
# Full credit to: http://jeffmiller.github.com/2011/01/10/ssh-host-color | |
#!/bin/bash | |
# | |
# ssh into a machine and automatically set the background | |
# color of Mac OS X Terminal depending on the hostname. | |
# | |
# Installation: | |
# 1. Save this script to /some/bin/ssh-host-color | |
# 2. chmod 755 /some/bin/ssh-host-color |
#! /bin/sh | |
### BEGIN INIT INFO | |
# Provides: redis-server | |
# Required-Start: $syslog | |
# Required-Stop: $syslog | |
# Should-Start: $local_fs | |
# Should-Stop: $local_fs | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: redis-server - Persistent key-value db |
### MATPLOTLIBRC FORMAT | |
# This is a sample matplotlib configuration file - you can find a copy | |
# of it on your system in | |
# site-packages/matplotlib/mpl-data/matplotlibrc. If you edit it | |
# there, please note that it will be overridden in your next install. | |
# If you want to keep a permanent local copy that will not be | |
# over-written, place it in HOME/.matplotlib/matplotlibrc (unix/linux | |
# like systems) and C:\Documents and Settings\yourname\.matplotlib | |
# (win32 systems). |
$ cat bootstrap.sh | |
#!/bin/sh | |
cat <<EOF > requirements.txt | |
whisper==0.9.7 | |
carbon==0.9.7 | |
graphite-web==0.9.7c | |
gunicorn | |
EOF |
def parse_payload(data): | |
assert data, "Invalid data to parse, it's empty." | |
length, extra = data.split(':', 1) | |
length = int(length) | |
payload, extra = extra[:length], extra[length:] | |
assert extra, "No payload type: %r, %r" % (payload, extra) | |
payload_type, remain = extra[0], extra[1:] | |
assert len(payload) == length, "Data is wrong length %d vs %d" % (length, len(payload)) |
%.html: %.md style.css Makefile | |
pandoc -c style.css -s -f markdown -t html --standalone -o $@ $< | |
%.odt: %.md Makefile | |
pandoc --standalone -f markdown -t odt -o $@ $< | |
%.pdf: %.md %.odt | |
markdown2pdf -f markdown -o $@ $< | |
all: doc.html doc.odt doc.pdf |
#!/bin/bash | |
# usage: time benchbulk.sh dbname | |
# it takes about 30 seconds to run on my old MacBook | |
BULKSIZE=1000 | |
DOCSIZE=100 | |
INSERTS=10 | |
ROUNDS=10 | |
DBURL="http://localhost:5984/$1" |
This gist is part of a blog post. Check it out at:
http://jasonrudolph.com/blog/2011/08/09/programming-achievements-how-to-level-up-as-a-developer
-- Pack this into an object file with ld: ld -r -b binary -o hello.o hello.lua | |
print "Hello, World!" |
#!/bin/bash | |
# Autor: Alex Wall | |
# Licence: GPLv3 | |
# pandoc (markdown2pdf) needs an path to a template | |
# this script searches for a template in a custom folder (TEMPLATE_DIR) | |
# you can pass any other option (e.g. xetex), it will be passed to markdown2pdf | |
# the default custom pandoc template (latex.template) in ~/.pandoc/templates | |
TEMPLATE="latex.template" |