This file has been truncated, but you can view the full file.
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
==> Downloading http://www.python.org/ftp/python/2.7.4/Python-2.7.4.tar.bz2 | |
Already downloaded: /Library/Caches/Homebrew/python-2.7.4.tar.bz2 | |
tar xf /Library/Caches/Homebrew/python-2.7.4.tar.bz2 | |
==> ./configure --prefix=/usr/local/Cellar/python/2.7.4 --enable-ipv6 --datarootdir=/usr/local/Cellar/python/2.7.4/share --datadir=/usr/local/Cellar/python/2.7.4/share --enable-framework=/usr/local/Cellar/python/2.7.4/Frameworks --without-gcc CFLAGS=-I/usr/local/include -I/usr/local/opt/sqlite/include LDFLAGS=-L/usr/local/lib -L/usr/local/opt/sqlite/lib MACOSX_DEPLOYMENT_TARGET=10.8 | |
./configure --prefix=/usr/local/Cellar/python/2.7.4 --enable-ipv6 --datarootdir=/usr/local/Cellar/python/2.7.4/share --datadir=/usr/local/Cellar/python/2.7.4/share --enable-framework=/usr/local/Cellar/python/2.7.4/Frameworks --without-gcc CFLAGS=-I/usr/local/include -I/usr/local/opt/sqlite/include LDFLAGS=-L/usr/local/lib -L/usr/local/opt/sqlite/lib MACOSX_DEPLOYMENT_TARGET=10.8 | |
checking build system type... x86_64-apple-darwin12.3.0 | |
check |
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
""" | |
An interactive HTTP server, starting a python debugger on each http request. | |
Set the value of "hr" to what you want the HTTP response to be, | |
and then type "c" to continue | |
Requires ipdb and bottle | |
""" | |
from bottle import * | |
import ipdb | |
@route('/favicon.ico') |
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 ephem, datetime, math | |
import matplotlib.pyplot as plt | |
venus = ephem.Venus() | |
jupiter = ephem.Jupiter() | |
observer=ephem.city('Los Angeles') | |
dates = [datetime.date(2012,3,1) + datetime.timedelta(days=x) for x in range(180)] | |
sep = [] | |
for date in dates: |
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 json | |
from functools import wraps | |
from flask import redirect, request, current_app | |
def support_jsonp(f): | |
"""Wraps JSONified output for JSONP""" | |
@wraps(f) | |
def decorated_function(*args, **kwargs): | |
callback = request.args.get('callback', False) | |
if callback: |
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 | |
from collections import namedtuple | |
from struct import unpack, calcsize | |
Header = namedtuple('Header', 'id totallength wavefmt format pcm channels frequency bytes_per_second bytes_by_capture bits_per_sample data bytes_in_data') | |
header_format = '4si8sihhiihh4si' | |
header_len = calcsize(header_format) | |
def read_wav(fname): | |
"Read in a wav file with simple header parsing, and return the sum of the absolute value of its samples" |
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 simplejson as json | |
import lxml | |
class objectJSONEncoder(json.JSONEncoder): | |
"""A specialized JSON encoder that can handle simple lxml objectify types | |
>>> from lxml import objectify | |
>>> obj = objectify.fromstring("<Book><price>1.50</price><author>W. Shakespeare</author></Book>") | |
>>> objectJSONEncoder().encode(obj) | |
'{"price": 1.5, "author": "W. Shakespeare"}' | |
""" |
NewerOlder