Skip to content

Instantly share code, notes, and snippets.

@zenazn
zenazn / hello.go
Created October 1, 2014 18:20
App Engine + Go version build tags
// +build go1.3
package hello
import (
"net/http"
"runtime"
)
func init() {
@zenazn
zenazn / gist:c5c8528efe1a00634096
Created May 4, 2014 18:07
agrison/golang-mux-benchmark
[master] ~/go/src/github.com/agrison/golang-mux-benchmark$ go test -bench=. 2>/dev/null
PASS
BenchmarkGocraftWeb_Simple 2000000 926 ns/op
BenchmarkGocraftWeb_Route15 1000000 2203 ns/op
BenchmarkGocraftWeb_Route75 1000000 2204 ns/op
BenchmarkGocraftWeb_Route150 1000000 2232 ns/op
BenchmarkGocraftWeb_Route300 1000000 2255 ns/op
BenchmarkGocraftWeb_Route3000 1000000 2481 ns/op
BenchmarkGocraftWeb_Middleware 1000000 1539 ns/op
BenchmarkGocraftWeb_Composite 500000 3518 ns/op
@zenazn
zenazn / git-fork
Last active August 29, 2015 13:59
#!/bin/bash
if [ "$#" -gt 1 -o -z "$1" ]; then
echo "Usage: $0 new-branch"
exit 1
fi
current_branch=$(git rev-parse --abbrev-ref HEAD)
new_branch=$1

Keybase proof

I hereby claim:

  • I am zenazn on github.
  • I am cj (https://keybase.io/cj) on keybase.
  • I have a public key whose fingerprint is E56F BC95 E04F 19B5 AF87 A872 EE74 F6A0 FE60 6F94

To claim this, I am signing this object:

@zenazn
zenazn / run.py
Created April 21, 2011 23:01
181 final project run script
#!/usr/bin/env python
import platform
import sys
import os
path = os.path.dirname(os.path.realpath(__file__))
if platform.system() == 'Darwin':
if map(int, platform.release().split('.')) >= [10, 0, 0]:
./configure \
--sbin-path=/usr/local/sbin \
--conf-path=/etc/nginx/nginx.conf \
--pid-path=/var/run/nginx.pid \
--lock-path=/var/lock/nginx.lock \
--error-log-path=/var/log/nginx/error.log \
--http-log-path=/var/log/nginx/access.log \
--http-client-body-temp-path=/var/lib/nginx/body \
--http-proxy-temp-path=/var/lib/nginx/proxy \
--http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
# Make ssh-agent and screen play well
# If you're connecting w/
ssh -At user@server screen -UxRR
# Put this in ~/.screenrc on remote
setenv SSH_AUTH_SOCK "/tmp/ssh-agent-$USER-screen"
# And put this in ~/.ssh/rc on remote
test $SSH_AUTH_SOCK && ln -sf "$SSH_AUTH_SOCK" "/tmp/ssh-agent-$USER-screen"