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
#!/usr/bin/env python | |
import os | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.dates as mdates | |
from datetime import datetime | |
PATH = os.path.abspath(os.path.dirname(__file__)) |
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 itemgetter | |
names = ['a', 'c', 'd', 'b'] | |
runes = [1, 2, 3, 4] | |
def mixer(a, b): | |
""" | |
Returns the second list sorted according to the first | |
""" | |
return [z[1] for z in sorted(zip(a, b), key=itemgetter(0))] |
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
#!/usr/bin/env python | |
# cats | |
# Count Anchor Tags | |
# | |
# Author: Benjamin Bengfort <[email protected]> | |
# Created: Thu Jun 19 06:34:50 2014 -0400 | |
# | |
# Copyright (C) 2014 Bengfort.com | |
# For license information, see LICENSE.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
import os | |
import json | |
import requests | |
from bs4 import BeautifulSoup | |
HOST = "http://data.dc.gov/" | |
ROOT = os.path.normpath(os.path.join(os.path.dirname(__file__), '../fixtures/')) | |
CATALOG = os.path.join(ROOT, 'catalog.html') | |
HTDOCS = os.path.join(ROOT, 'htdocs') |
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 matplotlib.pyplot as plt | |
from mpl_toolkits.mplot3d import Axes3D | |
pts0 = [ | |
(0, 0, 0), | |
(0, 1, 1), | |
(1, 0, 1), | |
(1, 1, 0), | |
] |
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
#!/usr/bin/env python | |
import turtle | |
D = 90 | |
L = 10 | |
def iterate(axiom, num=0, initator='F'): | |
""" | |
Compute turtle rule string by iterating on an axiom |
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
#!/usr/bin/env python | |
import os | |
import sys | |
import time | |
import pickle | |
import argparse | |
import operator | |
import unicodecsv as csv |
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 matplotlib | |
matplotlib.use('TKAgg') | |
import numpy as np | |
import matplotlib.cm as cm | |
import matplotlib.pyplot as plt | |
import matplotlib.animation as animation | |
N = 100 | |
ON = 255 |
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
#!/usr/bin/env python | |
import nltk.classify.util | |
from itertools import chain, imap | |
from string import punctuation | |
from nltk.corpus import stopwords | |
from nltk import wordpunct_tokenize | |
from nltk.classify import NaiveBayesClassifier |
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 nltk | |
from nltk.stem import WordNetLemmatizer | |
from nltk.tokenize import wordpunct_tokenize | |
class Mapper(object): | |
def __init__(self): | |
if 'stopwords' in self.params: | |
with open(self.params['stopwords'], 'r') as excludes: |