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
# -*- coding: utf-8 -*- | |
''' | |
Usage: | |
>>> f = open('usc08.10') | |
>>> x = getlines(f) | |
>>> x.next() | |
GPOLocatorLine(code='F', arg='5800', data=u'\r\n') | |
>>> print x.next().data | |
TITLE 8–ALIENS AND NATIONALITY |
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 | |
# -*- coding: utf-8 -*- | |
"""Simple async crawler/callback queue based on gevent.""" | |
import traceback | |
import logging | |
import httplib2 | |
import gevent |
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
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 |
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
{'email': u'[email protected]', | |
'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', |
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
{u'actions': {u'added': 5, u'removed': 0}, | |
u'user': {u'_id': u'50d34ac74a4ee9b329000001', | |
u'email': u'[email protected]', | |
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'}, |
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
{u'email': u'[email protected]', | |
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, |
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
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__': |
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
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 |
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
'''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 |
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
''' | |
Save this file and add the following line to your ~/.bashrc" | |
export PYTHONSTARTUP="$HOME/.pythonrc" | |
''' | |
import os | |
import readline | |
import rlcompleter | |
import atexit |
OlderNewer