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 | |
""" | |
The idea of this program is to equate the strings "rock", "paper", | |
"scissors", "lizard", "Spock" to numbers as follows: | |
0 - rock | |
1 - Spock | |
2 - paper | |
3 - lizard | |
4 - scissors |
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 os | |
import sys | |
DEFAULT_SIZE = 128 * 1024 * 1024 #128 MB | |
class Bucket(object): | |
""" | |
Handles the writing of a stream into a bucket. | |
Pass a path to a directory which holds the bucket, and |
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 | |
from nltk import Text | |
from nltk.corpus import PlaintextCorpusReader | |
CORPUS_ROOT = '/Users/benjamin/Development/corpora/gutenburg/' | |
if __name__ == "__main__": | |
reader = PlaintextCorpusReader(CORPUS_ROOT, '.*') |
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 | |
import sys | |
from datetime import datetime | |
from dateutil.tz import tzlocal | |
class Clock(object): | |
FORMATS = { | |
"code":"%a %b %d %H:%M:%S %Y %z", |
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 | |
import csv | |
import json | |
class PreferenceReader(object): | |
""" | |
A reader that can read the recommended format for storing preferences | |
of books in a tab-separated file. The recommended format is: |
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 | |
import operator | |
from math import sqrt | |
from reader import PreferenceReader | |
class SimilarityScoring(PreferenceReader): | |
""" | |
Extends the preference reader class to give our data structure the |
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 psycopg2 | |
HOST = "localhost" | |
PORT = "5432" | |
USER = "cobrain" | |
PASS = "" | |
NAME = "star_delta_0" | |
class Database(object): |
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
# graph | |
# Python object that creates an ordered GraphSON representation. | |
# | |
# Author: Benjamin Bengfort <[email protected]> | |
# Created: Mon Sep 23 11:30:05 2013 -0400 | |
# | |
# Copyright (C) 2013 Cobrain Company | |
# For license information, see LICENSE.txt | |
# | |
# ID: graph.py [] [email protected] $ |
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 | |
# graffiti.breakdance.s3 | |
# Handler class for writing to Amazon S3 | |
# | |
# Author: Benjamin Bengfort <[email protected]> | |
# Created: Fri Sep 27 08:48:19 2013 -0400 | |
# | |
# Copyright (C) 2013 Cobrain Company | |
# For license information, see LICENSE.txt |
OlderNewer