Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
#!/Users/chris/.ruby/current/bin/ruby | |
RUBY_HOME = ENV['RUBY_HOME'] | |
RUBIES = {:jruby => 'jruby-1.6.0', :rubinius => 'rubinius/1.2', :mri => 'mri19'} | |
GEM_EXECUTABLES = {:rubinius => 'gems/bin', :mri => ''} | |
if ARGV.empty? | |
p 'Available interpreters:' | |
RUBIES.each { |key,value| p key } |
import base64 | |
from myapplication import app | |
class MyTestCase(unittest.TestCase): | |
def setUp(self): | |
self.app = app.test_client() | |
def tearDown(self): | |
pass |
module Vagrant | |
module Provisioners | |
class Sprinkle < Base | |
register :sprinkle | |
class Config < Vagrant::Config::Base | |
attr_accessor :cookbooks_path | |
end | |
def prepare |
worldclock() { | |
ADDIS_ABABA=`TZ=Africa/Addis_Ababa date +"%c (%z %Z)"` | |
BERLIN=`TZ=Europe/Berlin date +"%c (%z %Z)"` | |
CHICAGO=`TZ=America/Chicago date +"%c (%z %Z)"` | |
HONK_KONG=`TZ=Asia/Hong_Kong date +"%c (%z %Z)"` | |
LONDON=`TZ=Europe/London date +"%c (%z %Z)"` | |
LOS_ANGELES=`TZ=America/Los_Angeles date +"%c (%z %Z)"` | |
MOSCOW=`TZ=Europe/Moscow date +"%c (%z %Z)"` | |
NEW_YORK=`TZ=America/New_York date +"%c (%z %Z)"` | |
SOFIA=`TZ=Europe/Sofia date +"%c (%z %Z)"` |
from subprocess import Popen, PIPE | |
import re | |
import glob | |
import shlex | |
class Pipeline(object): | |
def __init__(self, descriptor=None): | |
self.steps = [] | |
if descriptor: | |
for step in descriptor.split("|"): |
#!/usr/bin/python | |
# Equivalent of "tail -f" as a webpage using websocket | |
# Usage: webtail.py PORT FILENAME | |
# Tested with tornado 2.1 | |
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket | |
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/ | |
import tornado.httpserver |
#!/usr/bin/env bash | |
# Use this one-liner to produce a JSON literal from the Git log: | |
git log \ | |
--pretty=format:'{%n "commit": "%H",%n "author": "%aN <%aE>",%n "date": "%ad",%n "message": "%f"%n},' \ | |
$@ | \ | |
perl -pe 'BEGIN{print "["}; END{print "]\n"}' | \ | |
perl -pe 's/},]/}]/' |
Originally: | |
https://gist.github.com/7565976a89d5da1511ce | |
Hi Donald (and Martin), | |
Thanks for pinging me; it's nice to know Typesafe is keeping tabs on this, and I | |
appreciate the tone. This is a Yegge-long response, but given that you and | |
Martin are the two people best-situated to do anything about this, I'd rather | |
err on the side of giving you too much to think about. I realize I'm being very | |
critical of something in which you've invested a great deal (both financially |
""" | |
A really stupid python template language inspired by coffeekup, markaby. | |
Do not use this code, it will ruin your day. A byproduct of insomnia. | |
TL;DR | |
----- | |
This module defines a template language that allows us to do: | |
d = Doc() |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!