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 copy import copy | |
from random import randint | |
class Names(object): | |
def __init__(self, path="names.txt"): | |
self.path = path |
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 os | |
import sys | |
import time | |
ACCESS_KEY = '' | |
SECRET_KEY = '' | |
def get_name_for_file(url): |
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
## | |
# Adding the bin of my home directory to the path | |
## | |
export PATH=/Users/benjamin/bin:$PATH | |
## | |
# Setting the correct version of Python | |
## | |
export VERSIONER_PYTHON_VERSION=2.7 |
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
SELECT product, url FROM | |
(SELECT ROW_NUMBER() OVER (PARTITION BY vendor ORDER BY product DESC) AS r, t.* FROM | |
(SELECT vendor.name AS vendor, product.name AS product, COALESCE(shelf.detail_url, shelf.buy_url, NULL) AS url | |
FROM shelf | |
JOIN product ON product.id = shelf.product_id | |
JOIN vendor ON vendor.id = shelf.vendor_id) | |
AS t) | |
AS x | |
WHERE x.r <= 10 |
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 <ben@cobrain.com> | |
# Created: Mon Sep 23 11:30:05 2013 -0400 | |
# | |
# Copyright (C) 2013 Cobrain Company | |
# For license information, see LICENSE.txt | |
# | |
# ID: graph.py [] ben@cobrain.com $ |
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
{ | |
"auto_complete_commit_on_tab": true, | |
"bold_folder_labels": true, | |
"caret_style": "solid", | |
"color_scheme": "Packages/User/Monokai Soda.tmTheme", | |
"create_window_at_startup": false, | |
"ensure_newline_at_eof_on_save": true, | |
"file_exclude_patterns": | |
[ | |
".DS_Store", |
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 <ben@cobrain.com> | |
# Created: Fri Sep 27 08:48:19 2013 -0400 | |
# | |
# Copyright (C) 2013 Cobrain Company | |
# For license information, see LICENSE.txt |