Skip to content

Instantly share code, notes, and snippets.

View davedash's full-sized avatar
🏠
Working from home

Dave Dash davedash

🏠
Working from home
View GitHub Profile
@cespare
cespare / log.go
Created October 31, 2012 06:51
Golang apache logging
type ApacheLogRecord struct {
http.ResponseWriter
ip string
time time.Time
method, uri, protocol string
status int
responseBytes int64
elapsedTime time.Duration
}
@romanbarczynski
romanbarczynski / pyexiv2.sh
Created October 22, 2012 10:26
pyexiv2 ubuntu virtualenv install
. 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
@davedash
davedash / gist:2409061
Created April 17, 2012 21:08
wtfpython.py
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???
@pithyless
pithyless / mac-homebrew-pyexiv2.sh
Created January 22, 2012 17:19 — forked from jpwatts/mac-homebrew-pyexiv2.sh
In which I finally get pyexiv2 working on my Mac using Homebrew and a series of disgusting hacks
#!/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
@maximebf
maximebf / webtail.py
Created October 21, 2011 13:25
Web tail / tail -f as a webpage using websocket
#!/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
@chowse
chowse / ClientStatsD.js
Created June 22, 2011 20:34
StatsD for Client-Side Interactions
if (!Date.now) {
Date.now = function() {
return (new Date()).getTime();
};
}
var StatsD = (function($, undefined) {
@karmi
karmi / articles_tags__queries_filters_and_facets_in_elasticsearch.sh
Created January 23, 2011 17:17
Searching and facets in ElasticSearch
# (Re)create the index
#
curl -X DELETE "http://localhost:9200/articles"
curl -X PUT "http://localhost:9200/articles"
# Insert the data
#
curl -X POST "http://localhost:9200/articles/article" -d '{ "name" : "One", "tags" : ["ruby"] }'
curl -X POST "http://localhost:9200/articles/article" -d '{ "name" : "Two", "tags" : ["ruby", "python"] }'
curl -X POST "http://localhost:9200/articles/article" -d '{ "name" : "Three", "tags" : ["java"] }'