Skip to content

Instantly share code, notes, and snippets.

View chrisglass's full-sized avatar

Chris Glass chrisglass

View GitHub Profile
@chrisglass
chrisglass / run_revel_on_heroku.sh
Created December 4, 2012 21:38 — forked from tmc/run_revel_on_heroku.sh
run revel apps on heroku
☭ ~ $ revel new src/sweet_app
☭ ~ $ cd src/sweet_app/
☭ ~/sweet_app $ git init
☭ ~/sweet_app (master)$ cat > .godir
sweet_app
^C
☭ ~/sweet_app (master)$ git add .godir *
☭ ~/sweet_app (master)$ git ci -m"Initial"
☭ ~/sweet_app (master)$ heroku create --buildpack https://github.com/traviscline/heroku-buildpack-go-revel.git
☭ ~/sweet_app (master)$ git push heroku master
@chrisglass
chrisglass / tree.md
Created April 24, 2012 07:18 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@chrisglass
chrisglass / gist:1063056
Created July 4, 2011 08:21 — forked from atamurad/gist:1062584
mutex with redis
def acquire(name):
tries = 0
while True:
tries += 1
if tries >= 30:
raise Exception("Couldn't acquire lock on mutex "+name)
try:
n = r.incr("lock-"+name)
if n == 1:
return True