This file contains hidden or 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
type ApacheLogRecord struct { | |
http.ResponseWriter | |
ip string | |
time time.Time | |
method, uri, protocol string | |
status int | |
responseBytes int64 | |
elapsedTime time.Duration | |
} |
This file contains hidden or 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
. virtualenv/bin/activate | |
sudo apt-get install scons libexiv2-dev libboost-dev libboost-python-dev | |
mkdir build | |
cd build | |
wget http://launchpad.net/pyexiv2/0.3.x/0.3.2/+download/pyexiv2-0.3.2.tar.bz2 -O-| tar -xpvj | |
cd pyexiv2* | |
scons | |
scons install |
This file contains hidden or 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 testing import mocks | |
mocks.email # works | |
# mocks.user doesn't work even though there's a testing/mocks/user.py files | |
import testing.mocks.user # works fine | |
mocks.user # now works: wtf??? | |
This file contains hidden or 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 | |
brew install python scons boost exiv2 | |
curl -O http://launchpadlibrarian.net/83595798/pyexiv2-0.3.2.tar.bz2 | |
tar xjvf pyexiv2-0.3.2.tar.bz2 | |
cd pyexiv2-0.3.2 | |
# https://answers.launchpad.net/pyexiv2/+question/140742 | |
echo "env['FRAMEWORKS'] += ['Python']" >> src/SConscript |
This file contains hidden or 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/python | |
# Equivalent of "tail -f" as a webpage using websocket | |
# Usage: webtail.py PORT FILENAME | |
# Tested with tornado 2.1 | |
# Thanks to Thomas Pelletier for it's great introduction to tornado+websocket | |
# http://thomas.pelletier.im/2010/08/websocket-tornado-redis/ | |
import tornado.httpserver |
This file contains hidden or 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
if (!Date.now) { | |
Date.now = function() { | |
return (new Date()).getTime(); | |
}; | |
} | |
var StatsD = (function($, undefined) { |