Skip to content

Instantly share code, notes, and snippets.

View fatlotus's full-sized avatar

Jeremy Archer fatlotus

View GitHub Profile
@fatlotus
fatlotus / dp.py
Last active August 29, 2015 14:22
from __future__ import print_function
def run(x):
a = [1 for i in xrange(10)]
b = None
for i in xrange(x - 1):
b = [0 for i in xrange(10)]
s = sum(a)
@fatlotus
fatlotus / benchmarks.txt
Created May 26, 2013 20:56
This is a result of running parallel benchmarks on the CSIL Shuttle machines.
lcl% make
./sanitycheck
./benchmark
#RESULT 10995.858398
fab perform_run:LOCK_TYPE,WORKERS
LOCK_TYPE WORKERS VALUE MACHINE
-----------------------------------------------------
0 1 15,047.32 sh ---
0 1 40,903.68 as ----------
@fatlotus
fatlotus / README.md
Last active December 17, 2015 01:19 — forked from mbostock/.block

This choropleth encodes unemployment rates from 2008 with a quantize scale ranging from 0 to 15%. A threshold scale is a useful alternative for coloring arbitrary ranges.

@fatlotus
fatlotus / tweet_processor.py
Last active December 16, 2015 09:08
Tweet Processor Thingy
tweets = FlatFile("all_tweets.json")
@task(parallel=True)
def process():
word_counts = Counters()
for tweet in tweets:
words = tweet["text"].split()
for word in words:
@fatlotus
fatlotus / parsing.py
Last active December 16, 2015 03:59
Playing around with parser interfaces.
import datetime
for image in tiny_image_dataset:
image.parse("{image:rgb16x16}") # not line delimited
for line in massive_csv_file:
line.parse("{x},{y},{z}", skip_first = True)
for tweet in twitter_json_dataset:
tweet.parse("{tweet:json}")
@fatlotus
fatlotus / closures-in-python.py
Created April 12, 2013 17:13
Woo! Doing nasty things for fun and profit!
import byteplay
class Iterator(object):
def __init__(self, internal):
self.internal = internal
def iter(self, callback):
for i in self.internal:
callback(i)
@fatlotus
fatlotus / administration
Last active December 16, 2015 01:48
One way to interact with a distributed system.
$ cary-cluster add cluster ssh://user@head-node/my-big-cluster.clust
$ cary-cluster status
symbolize_article: not running
generate_adjacencies: not running
$ cary-cluster execute
compute job started...
$ cary-cluster status
symbolize_article: running, 0.5232 Mbps -> 0.12 Mbps; 2h 21m remaining
generate_adjacencies: blocked
$ cary-cluster info
/*
* Sample input:
*
* 1.0 2.0
* 2.0 3.0
*
* Sample output:
*
* Maximum number of jobs: 2
* Maximum wait time: 1.000000
/*
* turtle2ps.c
*
* I know how structs work- it just seemed simler
* to use recursion in this example:
*
* typedef struct MyStack {
* double x, y, t;
* struct MyStack * previous;
* } MyStack_T;
@fatlotus
fatlotus / statistics.txt
Created March 8, 2013 18:44
Statistics FTW!
$ ./processor statistics
# Global Counters
max_articles: 16777216
total_articles: 13057082 (77.8%)
w/title: 13057082 (100.0%)
w/id: 13057082 (100.0%)
w/incoming: 7366478 (56.4%)
w/outgoing: 11985748 (91.8%)
# Statistics: