Skip to content

Instantly share code, notes, and snippets.

View dropwhile's full-sized avatar
💭
neutrally buoyant

eli dropwhile

💭
neutrally buoyant
View GitHub Profile
@dropwhile
dropwhile / alembic.sh
Last active April 5, 2017 23:00
some examples of helper scripts I use: all files go in an ./env dir inside the project (git ignores them due to gitignore match). then you call them like ./env/run.sh
#!/bin/bash
source .tox/py27/bin/activate
source env/env.sh
alembic "$@"
@dropwhile
dropwhile / py27.txt
Last active June 3, 2019 13:51
python-2.7.14 and python-3.7.0 -- for centos7 (rpm fpm recipes)
##### 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"
@dropwhile
dropwhile / results.txt
Last active March 10, 2020 21:01
python compression comparison
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
@dropwhile
dropwhile / install-setup.txt
Last active February 28, 2020 05:43
python serialization speed comparison
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
@dropwhile
dropwhile / .netrc
Last active February 22, 2024 16:22
example netrc
# .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']
@dropwhile
dropwhile / gist:2556514
Created April 30, 2012 08:19
socketpool memcache example
# -*- 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
@dropwhile
dropwhile / gist:1234373
Created September 22, 2011 08:52
decorator soup
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
@dropwhile
dropwhile / gist:1141631
Created August 12, 2011 07:20
laundry

A poem about laundry.

I just did laundry.
I shrank a hooded sweatshirt.
I suck at laundry.

Originally posted on: 2005-11-28 (old blog post)

@dropwhile
dropwhile / rack_date.rb
Created December 22, 2010 23:00
Rack::Date middleware
## 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)