Skip to content

Instantly share code, notes, and snippets.

View simonklee's full-sized avatar

Simon Klee simonklee

View GitHub Profile
@simonklee
simonklee / nginx-uwsgi-django
Created June 22, 2010 06:41
nginx uwsgi django config
# FILE: /etc/init/uwsgi_[project].conf
description "uWSGI server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec uwsgi -s /tmp/uwsgi.sock -p 4 -M -t 20 -C -L \
-x [projectpath]/uwsgi.conf \
-H [projectpath]/ve \
CC = pdflatex
BIB = bibtex
VIEW = epdfview
NAME = ubicomp2010
FLAGS =
.PHONY: all clean view
.PRECIOUS: %.pdf
" Sets how many lines of history VIM has to remember
set history=700
" Enable filetype plugin
filetype plugin on
filetype indent on
" map leader
let mapleader = ","
let g:mapleader = ","
@simonklee
simonklee / smurf.vim
Created December 20, 2010 13:55
smurf color scheme for vim
set background=dark
hi clear
if exists("syntax_on")
syntax reset
endif
let g:colors_name="smurf"
hi Boolean ctermfg=181
hi Character ctermfg=181 cterm=bold
hi Comment ctermfg=244
@simonklee
simonklee / ipdb.py
Created May 2, 2011 09:20
ipdb without colors
import sys
from IPython.Debugger import Pdb
from IPython.Shell import IPShell
shell = IPShell(argv=[''])
def set_trace():
Pdb().set_trace(sys._getframe().f_back)
zone "trafo.no" {
type master;
file "/etc/master/trafo.no.zone";
allow-transfer {
127.0.0.1; # localhost
158.36.36.40; # ns1.uia.no
158.36.36.40; # ns2.uia.no
158.38.0.181; # nn.uninett.no
};
notify yes;
@simonklee
simonklee / transaction.go
Created March 29, 2012 19:23
MaxClientConn + 1
package main
import (
"fmt"
"github.com/simonz05/godis"
)
func main() {
done := make(chan int)
c := godis.New("", 0, "")
./redis-benchmark -c 1 -t set
====== SET ======
10000 requests completed in 1.25 seconds
1 parallel clients
3 bytes payload
keep alive: 1
100.00% <= 0 milliseconds
8012.82 requests per second
@simonklee
simonklee / gist:3721439
Created September 14, 2012 11:38
header
11:21:43.209049 IP 90.184.235.20.52287 > 95.211.176.20.80: Flags [.], seq 711801323:711802771, ack 1392190125, win 115, options [nop,nop,TS val 40180761 ec
E...).@.3...Z..._....?.P*m9.R."....s.......
.e..^M.^M$------WebKitFormBoundaryPqkMTDziBbktL8Lk^M
Content-Disposition: form-data; name="TextureData"; filename="minelogo-small.png"^M
Content-Type: image/png^M
^M
.PNG^M
.
...^MIHDR...............i... .IDATx..]e`...~....=..@pw-N..@.B...r.~..u..[.z.N[(E.B...!@<.m]f.|?vv..Y.nH.......9s....Bq..L.sn ..r.:..9@.]..9..... ..9w...
9...8C}....
@simonklee
simonklee / sql-norace.go
Created November 10, 2013 11:58
go build -race
package main
import (
"os"
"database/sql"
"fmt"
"sync"
_ "github.com/go-sql-driver/mysql"
)