I just did laundry.
I shrank a hooded sweatshirt.
I suck at laundry.
Originally posted on: 2005-11-28 (old blog post)
| #!/bin/bash | |
| source .tox/py27/bin/activate | |
| source env/env.sh | |
| alembic "$@" | 
| ##### Configurable options | |
| BUILD_VER=2.7.14 | |
| # strip symbols to slightly reduce runtime memory footprint | |
| STRIP="yes" | |
| # use altinstall to NOT symlink python and python2 to the python2.7 executable | |
| ALTINSTALL="yes" | |
| # build as user, requires configured sudo (for yum and fpm gem install). | |
| # if not "yes", then build should be done as root | |
| USE_SUDO="yes" | 
| Data Size: | |
| Input: 2074 | |
| LZ4: 758 (0.37) | |
| Snappy: 676 (0.33) | |
| LZF: 697 (0.34) | |
| ZLIB: 510 (0.25) | |
| LZ4 / Snappy: 1.121302 | |
| LZ4 / LZF: 1.087518 | |
| LZ4 / ZLIB: 1.486275 | |
| Benchmark: 50000 calls | 
| virtualenv --no-site-packages hodor | |
| hodor/bin/pip install simplejson ujson cbor tnetstring msgpack-python | |
| curl -s 'http://www.json-generator.com/api/json/get/cvfsLVmKiG?indent=2' > test.json | |
| hodor/bin/python shootout.py | 
| # .netrc | |
| ## generate token with https://help.github.com/articles/creating-an-oauth-token-for-command-line-use | |
| machine github.com login <token> | 
| >>> rows = [(1,2,3), (4,5,6), (7,8,9)] | |
| >>> [','.join(map(str,row[offset:offset+3])) | |
| ... for offset in range(0, len(rows) / 3) | |
| ... for row in rows] | |
| ['1,2,3', '4,5,6', '7,8,9'] | 
| # -*- coding: utf-8 - | |
| # | |
| import logging | |
| import random | |
| import memcache | |
| import gevent.socket | |
| # monkey patch to patch sockets | |
| memcache.socket = gevent.socket | |
| from socketpool.pool import ConnectionPool, MaxTriesError | 
| import functools | |
| def _decorate_method(f, name): | |
| @functools.wraps(f) | |
| def __wrapper(self, *args, **kwds): | |
| print 'wrapped a method', f, name | |
| return f(self, *args, **kwds) | |
| return __wrapper | |
| ## Rack middleware for adding a Date http header | |
| ## Some http servers do not set this, so use only if necessary | |
| require 'time' | |
| module Rack | |
| class Date | |
| def initialize(app) | |
| @app = app | |
| end | |
| def call(env) |