Skip to content

Instantly share code, notes, and snippets.

@jacobian
jacobian / unicorn.py
Created October 6, 2009 22:39
Simple preforking echo server in Python.
"""
Simple preforking echo server in Python.
Python port of http://tomayko.com/writings/unicorn-is-unix.
"""
import os
import sys
import socket
@jacobian
jacobian / unicorn-socketserver.py
Created October 7, 2009 13:45
A simple preforking echo server using SocketServer.
"""
Simple forking echo server built with Python's SocketServer library. A more
Pythonic version of http://gist.github.com/203520, which itself was inspired
by http://tomayko.com/writings/unicorn-is-unix.
"""
import os
import SocketServer
class EchoHandler(SocketServer.StreamRequestHandler):
@jacobian
jacobian / echo.c
Created October 7, 2009 19:13 — forked from paulsmith/echo.c
/**
* A simple preforking echo server in C.
*
* Building:
*
* $ gcc -Wall -o echo echo.c
*
* Usage:
*
* $ ./echo
@jacobian
jacobian / unicorn.php
Created October 8, 2009 15:10
This was written by Russell Beattie; I copied it here from a pastebin to give it a permanent home.
<?
/*
Simple preforking echo server in PHP.
Russell Beattie (russellbeattie.com)
PHP port of http://tomayko.com/writings/unicorn-is-unix
*/
/* Allow the script to hang around waiting for connections. */
set_time_limit(0);
# Prevent pip from doing anything unless you're inside an activated virtualenv.
PIP=/usr/local/bin/pip
function pip {
if [ "x$VIRTUAL_ENV" = 'x' ]; then
echo "No virtualenv activated; bailing."
else
$PIP -E `basename $VIRTUAL_ENV` "$@"
fi
}
/
GET -> list of projects
/{project}
GET -> project info
PUT -> create new project (not req'd; created if needed)
DELETE -> delete project and all build info
/{project}/builds
GET -> list of recent builds; pagination for all builds
cd /tmp
wget http://codespeak.net/lxml/lxml-2.2.2.tgz
tar -xzvf lxml-2.2.2.tgz
cd lxml-2.2.2
cd libs/
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.3.tar.gz
wget ftp://xmlsoft.org/libxml2/libxslt-1.1.24.tar.gz
cd ..
python setup.py build --static-deps --libxml2-version=2.7.3 --libxslt-version=1.1.24
sudo python setup.py install
@jacobian
jacobian / rst.py
Created January 15, 2010 21:41
My custom reStructuredText rendering tag for my blog
from django import template
from django.utils.encoding import smart_str, force_unicode
from django.utils.safestring import mark_safe
import docutils.nodes
from docutils.core import publish_parts
from docutils.writers import html4css1
register = template.Library()
def restructuredtext(value):
def print_name(for_user):
print "name is %s" % for_user
print_name(for_user="Travis Swicegood")

Lightning Talks - Friday PM

  1. Jacob Kaplan-Moss - How to give a lightning talk
  2. Van Lindberg - What Open Source lawyers do
  3. Greg Wilson - The Next Great Programing Book
  4. Moshe Zadke - Don't write big applications
  5. Ned Batchelder - What's new in coverage.py
  6. Mike MacCana - Docx - 100% native MSWord
  7. Trent Mick - Python Cookbook online