This file contains hidden or 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
# I just put this puppy in my .bashrc. | |
# Usage: | |
# - pin # equivalent to "touch __init__.py" | |
# - pin some/dir # equivalent to "touch some/dir/__init__.py" | |
# | |
# Thanks to paultag for lending me his bash chops. | |
# | |
function pin { if [ "x$1" = "x" ]; then DIR="./"; else DIR="$1"; fi; touch ${DIR}/__init__.py; } |
This file contains hidden or 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
"{\"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\": |
This file contains hidden or 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
Package: r-base | |
Priority: optional | |
Section: universe/math | |
Installed-Size: 70 | |
Maintainer: Ubuntu Developers <[email protected]> | |
Original-Maintainer: Dirk Eddelbuettel <[email protected]> | |
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 |
This file contains hidden or 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
$ virtualenv pydata2013 | |
$ source ./pydata2013/bin/activate | |
$ git clone [email protected]:twneale/citation-network-analysis.git | |
$ cd citation-network-analysis | |
# Note: if the follwing step fails, you're missing dependencies. If resolving them is not you're cup of tea, | |
# I recommend installing the free anaconda distribution of python from Continuum Analytics: https://store.continuum.io/ | |
$ pip install -r requirements.txt |
This file contains hidden or 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
''' | |
A boggle board is a mapping of coordinates to letters. | |
''' | |
from os.path import dirname, abspath, join | |
import pdb | |
import json | |
import random | |
from itertools import chain, product | |
from functools import partial | |
from operator import add, itemgetter |
This file contains hidden or 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
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): |
This file contains hidden or 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
'''See http://stackoverflow.com/a/5359988/120991 | |
''' | |
from fabric.api import * | |
from contextlib import contextmanager | |
env.update( | |
use_ssh_config=True, | |
directory='/home/ubuntu/projects/thingy', |
This file contains hidden or 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 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) |
This file contains hidden or 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 re | |
import os | |
import sys | |
import json | |
import contextlib | |
import lxml.etree | |
@contextlib.contextmanager |
This file contains hidden or 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 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() |