Skip to content

Instantly share code, notes, and snippets.

View TestingBytes's full-sized avatar

Sam Johnson TestingBytes

View GitHub Profile
@soopercorp
soopercorp / findbest.py
Created February 20, 2012 23:38
bestthing.info algorithm
#!/usr/bin/env python
import cPickle as pickle
import random
# things I beat
tIB = {}
# things beat me
tBM = {}
@tmarkiewicz
tmarkiewicz / statsmix.py
Created December 9, 2010 21:10
Python code to access the StatsMix API
# send a new stat to a metric
import httplib
import urllib
params = urllib.urlencode({'metric_id': XXXXX, 'value': 1})
# generated_at is set to now by default, to explicitly set use the following:
# params = urllib.urlencode({'metric_id': 4877, 'value': 1, 'generated_at':'2012-07-08 12:33:53'})
headers = {'X-StatsMix-Token': 'STATSMIX_API_KEY'}
conn = httplib.HTTPConnection('api.statsmix.com:80')
conn.request('POST', '/api/v2/stats', params, headers)
response = conn.getresponse()