This guide assumes a fresh install of Mac OSX 10.7 Lion.
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
#!/bin/sh | |
set -e | |
# Ping FCGI server. Uses cgi-fcgi program from libfcgi library. | |
# Retrieves the root path (/) from host:port specified on command line. | |
if [ -z "$1" ] ; then | |
echo "Usage: $0 host:port|path/to/socket" >&2 | |
exit 1 | |
fi |
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
#!/bin/sh | |
# Start/stop the named twistd application | |
# | |
APP=/opt/myapp/myapp.py | |
TWISTD=/usr/bin/twistd | |
PID=/var/run/myapp.pid | |
LOGFILE=/var/log/myapp/myapp.log | |
DESCRIPTION="Super duper Twisted apptacularness!" | |
NAME=myapp |
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 flask import Flask, request | |
from gevent.event import AsyncResult | |
from gevent.wsgi import WSGIServer | |
app = Flask(__name__) | |
waiters = [] | |
@app.route("/") | |
def main(): |
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 | |
# reader = csv.reader(open('4956984.csv', 'rb')) | |
def gen_chunks(reader, chunksize=100): | |
""" | |
Chunk generator. Take a CSV `reader` and yield | |
`chunksize` sized slices. | |
""" |
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
"""This plugin provides test timings to identify which tests might be | |
taking the most. From this information, it might be useful to couple | |
individual tests nose's `--with-profile` option to profile problematic | |
tests. | |
This plugin is heavily influenced by nose's `xunit` plugin. | |
Add this command to the way you execute nose:: | |
--with-test-timer |
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 | |
import gevent | |
from gevent import Greenlet | |
from gevent.pool import Pool | |
from gevent.server import StreamServer | |
from gevent.socket import create_connection | |
bind_addr = '127.0.0.1' |
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
<!doctype html> | |
<html> | |
<head> | |
</head> | |
<body> | |
<!doctype html> | |
<html> | |
<head> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script> |
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
# Class for managing multiple servers or anything with start() and stop() methods | |
class ServerRack(object): | |
def __init__(self, servers): | |
self.servers = servers | |
def start(self): | |
started = [] | |
try: |
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
# -*- coding: utf-8 -*- | |
# Author: Douglas Creager <[email protected]> | |
# This file is placed into the public domain. | |
# Calculates the current version number. If possible, this is the | |
# output of “git describe”, modified to conform to the versioning | |
# scheme that setuptools uses. If “git describe” returns an error | |
# (most likely because we're in an unpacked copy of a release tarball, | |
# rather than in a git working copy), then we fall back on reading the | |
# contents of the RELEASE-VERSION file. |
OlderNewer