Skip to content

Instantly share code, notes, and snippets.

View twneale's full-sized avatar

Thom Neale twneale

View GitHub Profile
@twneale
twneale / gist:5614681
Created May 20, 2013 19:12
My Borked R setup
Package: r-base
Priority: optional
Section: universe/math
Installed-Size: 70
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: Dirk Eddelbuettel <edd@debian.org>
Architecture: all
Version: 2.14.1-1
Depends: r-base-core (>= 2.14.1-1), r-recommended (= 2.14.1-1)
Recommends: r-base-html, r-doc-html
@twneale
twneale / gist:5613913
Created May 20, 2013 17:49
NY State assembly voter ids.
"{\"NYV00010065\": {\"NYL000076\": 1, \"NYL000167\": 1, \"NYL000166\": 1, \"NYL000165\": 1, \"NYL000164\": 1, \"NYL000088\": 1, \"NYL000162\": 1, \"NYL000161\": 1, \"NYL000160\": 1, \"NYL000277\": 1, \"NYL000275\": 1, \"NYL000087\": 1, \"NYL000080\": 1, \"NYL000081\": 1, \"NYL000169\": 1, \"NYL000168\": 1, \"NYL000178\": 1, \"NYL000170\": 1, \"NYL000171\": 1, \"NYL000173\": 1, \"NYL000174\": 1, \"NYL000175\": 1, \"NYL000176\": 1, \"NYL000177\": 1, \"NYL000070\": 1, \"NYL000073\": 1, \"NYL000072\": 1, \"NYL000075\": 1, \"NYL000265\": 1, \"NYL000077\": 1, \"NYL000267\": 1, \"NYL000269\": 1, \"NYL000089\": 1, \"NYL000109\": 1, \"NYL000108\": 1, \"NYL000105\": 1, \"NYL000104\": 1, \"NYL000107\": 1, \"NYL000106\": 1, \"NYL000101\": 1, \"NYL000100\": 1, \"NYL000103\": 1, \"NYL000102\": 1, \"NYL000215\": 1, \"NYL000214\": 1, \"NYL000217\": 1, \"NYL000216\": 1, \"NYL000066\": 1, \"NYL000067\": 1, \"NYL000064\": 1, \"NYL000212\": 1, \"NYL000068\": 1, \"NYL000069\": 1, \"NYL000219\": 1, \"NYL000218\": 1, \"NYL000185\":
@twneale
twneale / gist:5118262
Created March 8, 2013 17:38
Make a nested class definition inherit the attributes of the class in whose scope it was defined.
'''Make a nested class definition inherit the attributes of
the class in whose scope it was defined.
'''
class Context(object):
'''Base type for Context objects.
'''
pass
@twneale
twneale / gist:5110912
Last active December 14, 2015 15:49
Parse plain text columns into a table.
class PlaintextColumns(object):
'''
Parse plain text columns like this into a table:
cols = """
Austin Errington Lawson, L Pryor
Bartlett Forestal Macer Riecken
Battles GiaQuinta Moed Shackleford
Bauer Goodin Moseley Smith, V
Brown,C Hale Niezgodsk Stemler
@twneale
twneale / gist:4353639
Last active December 10, 2015 00:48
Bumble from the shell!
import requests
def bumble(text):
url="http://smokehouse.sunlightlabs.org/action"
requests.get(url, params=dict(mode='bumble', message=text))
print 'bumbled: %r' % text
if __name__ == '__main__':
{u'email': u'twneale@gmail.com',
u'interests': [{u'active': False,
u'changed_at': 1353100593.0,
u'filters': {u'state': u'CA'},
u'in': u'rent',
u'interest_type': u'search',
u'query_type': u'advanced',
u'search_type': u'state_bills'},
{u'active': True,
u'changed_at': 1353338983.0,
{u'actions': {u'added': 5, u'removed': 0},
u'user': {u'_id': u'50d34ac74a4ee9b329000001',
u'email': u'twneale@gmail.com',
u'interests': [{u'_id': u'50d3512c4a4ee90c4d000004',
u'created_at': u'2012-12-20T12:55:58-05:00',
u'filters': {u'state': u'CA'},
u'in': u'rent',
u'interest_type': u'search',
u'query_type': u'advanced',
u'updated_at': u'2012-12-20T12:55:58-05:00'},
{'email': u'twneale@gmail.com',
'interests': [{'active': False,
'changed_at': datetime.datetime(2012, 11, 16, 21, 16, 33, 661000),
'filters': {'state': u'CA'},
'in': u'rent',
'interest_type': 'search',
'query_type': 'advanced',
'search_type': 'state_bills'}],
'notifications': 'email_daily',
'secret_key': 'openstates-scout-staging',
@twneale
twneale / ubuntu-neo4j.sh
Created July 28, 2012 20:17 — forked from quinn/ubuntu-neo4j.sh
neo4j on ubuntu
sudo apt-get install openjdk-6-jre-headless
curl -O http://dist.neo4j.org/neo4j-community-1.5.M02-unix.tar.gz
tar -xf neo4j-community-1.5.M02-unix.tar.gz
rm neo4j-community-1.5.M02-unix.tar.gz
neo4j-community-1.5.M02/bin/neo4j start
@twneale
twneale / crawler.py
Created April 5, 2012 22:57 — forked from jmoiron/crawler.py
Simple gevent/httplib2 web crawler.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Simple async crawler/callback queue based on gevent."""
import traceback
import logging
import httplib2
import gevent