This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# earl, 2008-07-22 | |
from __future__ import with_statement | |
import stringtemplate3, simplejson, sys | |
def main(): | |
with open(sys.argv[1]) as template_file: | |
template = stringtemplate3.StringTemplate(template_file.read()) | |
template.attributes = simplejson.load(sys.stdin) | |
sys.stdout.write(unicode(template).encode('utf-8')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// start w/ ringo-web j2d | |
// j2d/config.js | |
exports.urls = [['/', 'actions']]; | |
exports.app = require("ringo/webapp").handleRequest; | |
// j2d/actions.js | |
import("binary"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("ringo/processing").wire(this); | |
function setup() { | |
size(800, 600); | |
colorMode(RGB, 1); | |
background(0); | |
stroke(0.8); | |
strokeWeight(10); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# chl, 2010-04-27 | |
# http://blog.tech.stylefeeder.com/2008/05/27/generating-primary-keys/ | |
import math | |
NUM = "0123456789" | |
LOWER = "abcdefghijklmnopqrstuvwxyz" | |
UPPER = LOWER.upper() | |
ALPHANUM = NUM + LOWER + UPPER | |
ASCII_94 = [chr(33 + x) for x in xrange(94)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# chl, 2010-05-18 | |
# jaccard coefficient experiment, inspired by @datajunkie | |
from __future__ import with_statement, division | |
import collections | |
S = collections.defaultdict(set) | |
T = collections.defaultdict(set) # inverse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Adapted from Jonathan Feinberg's Python port of original code by luis2048 | |
// http://github.com/jdf/processing.py/blob/master/examples.py/Topics/Effects/Metaball/Metaball.py | |
require("ringo/processing").wire(this); | |
var coord = [ | |
[0, 0], | |
[90, 120], | |
[90, 45] | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import argparse | |
import re | |
import simplejson | |
parser = argparse.ArgumentParser(description="Select fields (at depth) from one-record-per-line JSON streams") | |
parser.add_argument("-d", default=".", help="Path delimiter (default: .)") | |
parser.add_argument("-x", default="@", help="Array indexing prefix (default: @)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -s "https://www.coursera.org/maestro/api/topic/list?full=1" | jq ".[] | select(.self_service_course_id) | [{name, self_service_course_id}]" |