Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
class Main { | |
// if you want to print something | |
// initialize i to new IO object | |
i : IO <- new IO; | |
// body of the program is a block of expressions | |
// the first one executes out_string call to the object | |
// i which prints "hello world", and second evaluates to 1 | |
// which is the value of the block, which becomes the | |
// value of the method |
/** | |
* User: jz | |
* Date: 4/23/12 | |
* Time: 5:00 PM | |
*/ | |
package main | |
import ( | |
"fmt" | |
"os" |
# for 2x2 games | |
# PR_t+1(i) = (PR_t(i) * pi(i))/sum from j=1 to n (Pr_t(j)*pi(j)) | |
# payoff = pi(i) | |
# proportion = Pr(i) | |
# w = weights | |
payoffs = [[[2,2], [2,0]], | |
[[0,2], [3,3]]] | |
payoffs = [[[2,2], [0,0]], |
import hashlib | |
import shelve | |
def trim_hash(hash, offset=5): | |
"""outputs truncated hash | |
""" | |
return '0' * offset + hash[offset:] | |
def write_word_to_shelf(shelf_fn, wordfile): | |
"""write hashes of words in wordfile |
import networkx as nx | |
import matplotlib.pyplot as plt | |
isnot = [('Spain', 'Greece'), | |
('Portugal', 'Greece'), | |
('Greece', 'Ireland'), | |
('Spain', 'Ireland'), | |
('Spain', 'Portugal'), | |
('Ireland', 'Greece'), | |
('Portugal', 'Ireland'), |
#!/usr/bin/python | |
# | |
# wget wget http://www2.imm.dtu.dk/pubdb/views/edoc_download.php/6010/zip/imm6010.zip | |
# unzip imm6010.zip | |
import math | |
import re | |
import sys | |
reload(sys) | |
sys.setdefaultencoding('utf-8') |
Go at Heroku | |
http://blog.golang.org/2011/04/go-at-heroku.html | |
Why you PHP guys should learn Golang | |
http://www.mikespook.com/2012/08/why-you-php-guys-should-learn-golang/ | |
Go at CloudFlare | |
http://blog.cloudflare.com/go-at-cloudflare | |
Go at Moovweb |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
Locate the section for your github remote in the .git/config
file. It looks like this:
[remote "origin"]
fetch = +refs/heads/*:refs/remotes/origin/*
url = [email protected]:joyent/node.git
Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/*
to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:
import csv | |
import json | |
with open('metrics.json', 'r') as f: | |
data = json.load(f) | |
keys = data[0].keys() | |
writer = csv.DictWriter(open('metrics.csv', 'wb'), keys) | |
writer.writer.writerow(keys) | |
writer.writerows(data) |