Skip to content

Instantly share code, notes, and snippets.

Thom Neale twneale

Block or report user

Report or block twneale

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am twneale on github.
  • I am twneale ( on keybase.
  • I have a public key ASBHERV361ILHrWj9WnVa_X7mI5u8FrXDmrlwqhOswPRsgo

To claim this, I am signing this object:

twneale / gist:ef11712e43991d671747
Created Jun 11, 2014
All hyperlinked citations in the Boston municipal code
View gist:ef11712e43991d671747
Any person violating any provision of subsection
shall be punished by a fine not exceeding twenty ($20.00) dollars for each offense, and not only the
The provisions of subsection
to the contrary notwithstanding, this ordinance shall be published by the action of the City Council
twneale / gist:86ac56607f48ab375e60
Created Jun 5, 2014
Duped US Code identifiers
View gist:86ac56607f48ab375e60
[('/us/usc/t21/s812/b/1', 4),
('/us/usc/t21/s812/b/4', 4),
('/us/usc/t21/s812/b/5', 4),
('/us/usc/t21/s812/b/2', 4),
('/us/usc/t21/s812/a', 4),
('/us/usc/t21/s812/b', 4),
('/us/usc/t21/s812/b/3', 4),
('/us/usc/t21/s812/c', 4),
('/us/usc/t42/s14214/d/10', 3),
('/us/usc/t21/s812/a/1', 3),
View gist:4c4bc80c35ed7c1fef40
- The xml for /us/usc/t25/s450l (Contract or grant specifications) contains a model agreement with its own internal
Thom Neale <>
Apr 13
to Katherine
Hi Katherine, please forgive the earlier email fragment; I accidentally sent if before I was done typing.
twneale /
Last active Dec 16, 2016
Calculating legislator ideal points with Python
from sunlight import openstates, response_cache
from pscl.ext.openstates import RollcallBuilder
spec = dict(state='al', chamber='lower', search_window='term:2011-2014')
valid_ids = [leg['id'] for leg in openstates.legislators(spec)]
twneale /
Last active Aug 29, 2015
Basic uscode citation-to-neoid function.
import re
def citations(text):
rgx = u'(\\d+)\\s+U\\.?S\\.?C\\.?\\s*\xa7*\\s\\s*([\\d\\w\\-\\\u2013\\.\u2013]+)(\\([\\d\\w\\-\\\u2013\\.\u2013()]+\\))*'
matches = []
for match in re.finditer(rgx, text):
title, section, path = match.groups()
section = section.strip(u'\u2013.- ')
start, end = match.span()
twneale / gist:8363605
Created Jan 10, 2014
Get a set of all paragraph numbers used in the Code of Federal Regulations
View gist:8363605
import re
import os
import sys
import json
import contextlib
import lxml.etree
twneale / gist:7826458
Created Dec 6, 2013
How to compare two strings with difflib
View gist:7826458
>>> import difflib
>>> for opcode in difflib.SequenceMatcher(None, "This is a test.", "That is a tent").get_opcodes():
... print opcode
('equal', 0, 2, 0, 2)
('replace', 2, 4, 2, 4)
('equal', 4, 12, 4, 12)
('replace', 12, 13, 12, 13)
('equal', 13, 14, 13, 14)
('delete', 14, 15, 14, 14)
twneale / gist:6855493
Last active Mar 25, 2018
fab context manager to activate virtualenv before running command
View gist:6855493
from fabric.api import *
from contextlib import contextmanager
twneale / gist:6443253
Created Sep 4, 2013
Salty bet search script
View gist:6443253
from operator import methodcaller
import lxml.html
from whoosh.index import create_in
from whoosh.fields import *
from whoosh.qparser import QueryParser
class Stats(object):
You can’t perform that action at this time.