Skip to content

Instantly share code, notes, and snippets.

View reiddraper's full-sized avatar
🍹

Reid Draper reiddraper

🍹
View GitHub Profile
def gist_test():
a = 'test' * 5
return a
import urllib2
url = 'http://google.com'
response = urllib2.urlopen(url)
print response.read()
import networkx as nx
G = nx.read_gpickle('lebanese.mp3.graph.gpickle')
# pos has the x, y coordinates of the nodes
pos = nx.spring_layout(G)
# you'll need to figure out how to draw the edges yourself though I think
# drawing
D = nx.DiGraph()
n = G.nodes()
m = {}
for i, x in enumerate(n):
m[x] = i
for a,b in G.edges():
#!/usr/bin/env python
import web
urls = ('/(.*)', 'hello')
app = web.application(urls, globals())
class hello:
def GET(self, name):
return 'hello, world'
@reiddraper
reiddraper / gist:333224
Created March 15, 2010 19:30
supervisord.conf
[inet_http_server] ; inet (TCP) server disabled by default
port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface)
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
[supervisord]
logfile=/tmp/supervisord.log ; (main log file;default $CWD/supervisord.log)
logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB)
logfile_backups=10 ; (num of main logfile rotation backups;default 10)
loglevel=info ; (log level;default info; others: debug,warn,trace)
#!/usr/bin/env python
"""
Fetch all a user's Last.fm scrobbles by paging through their recent tracks
Usage: ./fetch.py <username> [<start_page> [<end_page>]]
Be aware: You may end up with duplicated data if the user is scrobbling
when you fetch for tracks. Make sure you check for dupes when you process
the XML later
"""
import httplib
h = httplib.HTTPConnection('www.google.com', 80)
h.request('GET', '/', headers = {'Cookie': 'Cookie1=foo; Cookie2=bar'})
z = h.getresponse()
z.status
z.read()
set softtabstop=4
set tabstop=4
set expandtab
set sw=4
set scroll=26
syntax on
set cursorline
set ai
set number
{mode, max}.
{duration, 15}.
{concurrent, 5}.
{driver, basho_bench_driver_riakclient}.
{code_paths, ["deps/stats",
"/Users/jmeredith/basho/riak/apps/riak_kv",