Download Xcode from the mac app store
Setup homebrew_:
/usr/bin/ruby -e "$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)"
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 sys | |
def bad_line(line, index): | |
if line[index] != 'U': | |
return True | |
def process_file(f, index): | |
index = int(index) | |
bad_records = [] | |
for i,line in enumerate(f): | |
if line.strip(): |
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 sys, StringIO | |
import argparse | |
from boto.s3.connection import S3Connection | |
def read_in_chunks(file_object, chunk_size=1024): | |
"""Lazy function (generator) to read a file piece by piece. | |
Default chunk size: 1k.""" | |
while True: | |
data = file_object.read(chunk_size) | |
if not data: | |
break |
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
from pyres import ResQ | |
def job(queue, resq=ResQ(),debug=False): | |
def wrapper(func): | |
def enqueue(*args): | |
if not debug: | |
class_name = '%s.%s' % (func.__module__, func.__name__) | |
resq.enqueue_from_string(class_name, queue, *args) | |
else: | |
return func(*args) |
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
def lookup(records, zipcode): | |
new_list = [] | |
for item in record: | |
new_list.append(item/global_lookup(zipcode)) | |
return new_list | |
map(lookup, [array of lists],[zipcode for range(len([array of lists]))) |
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 random | |
f = open('raffle_recipients.txt') | |
recipient_list = set([i.strip() for i in f.readlines()]) | |
chooser = random.SystemRandom() | |
print chooser.sample(recipient_list, 2) |
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 venusian | |
class route(object): | |
venusian = venusian | |
def __init__(self, name, url): | |
self.name = name | |
self.url = 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
import os | |
from setuptools import setup, find_packages | |
version=__import__('django_pyres').__version__ | |
def read(fname): | |
return open(os.path.join(os.path.dirname(__file__), fname)).read() | |
setup( | |
name='django-pyres', | |
version=version, | |
description='django pyres integration', | |
long_description=read('README.md'), |
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
trial_length = forms.IntegerField(widget=forms.TextInput(attrs={'size': '3', 'maxlength': '2'}), label='Number of days in Trial period', required=False) |