Skip to content

Instantly share code, notes, and snippets.

View mikewaters's full-sized avatar

Mike Waters mikewaters

  • Dealertrack
View GitHub Profile
@miku
miku / 4956984-1.py
Created February 10, 2011 13:16
How do you split a csv file into evenly sized chunks in Python?
#!/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.
"""
from flask import Flask, request
from gevent.event import AsyncResult
from gevent.wsgi import WSGIServer
app = Flask(__name__)
waiters = []
@app.route("/")
def main():
#!/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
@mpasternacki
mpasternacki / pingfcgi.sh
Created October 13, 2009 18:40
Ping FCGI server, using cgi-fcgi program from libfcgi library.
#!/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