Skip to content

Instantly share code, notes, and snippets.

View surma's full-sized avatar
🍑

Surma surma

🍑
View GitHub Profile
@surma
surma / ctxtest.go
Created December 9, 2012 16:07
Gorilla Side Effects
package main
import (
"fmt"
"log"
"net/http"
"github.com/gorilla/mux"
"github.com/gorilla/context"
)
@surma
surma / routertest.go
Last active December 11, 2015 00:29
Router Test
package main
import (
"fmt"
"io"
"net/http"
"net/http/httptest"
"os"
"github.com/gorilla/mux"
@surma
surma / v8test.go
Created March 12, 2013 12:56
go-v8 test
package main
import (
"log"
v8 "github.com/voxelbrain/go-v8"
)
func main() {
ctx := v8.NewContext()
@surma
surma / gist:5144419
Created March 12, 2013 16:32
Error of go-v8
#
# Fatal error in HandleScope::HandleScope
# Entering the V8 API without proper locking in place
#
SIGABRT: abort
pc: 0x7fff8c1c8212
goroutine 1 [chan receive]:
@surma
surma / nginx.conf
Created March 14, 2013 16:44
NginX for Auth Dialog
events {
worker_connections 1024;
}
# http {
# server {
# listen localhost:8080;
# server_name elasticpass.surmair.de;
# location / {
Script started on Thu Mar 21 13:39:13 2013
%
]2;surma@Charlie: ~]1;~
┌[surma@Charlie] [/dev/ttys003]
└[~]> 
bck-i-search: _script log.txtp_./Wineskin.appp_   
CCC=/usr/bin/clang pip install mitmproxy
]2;CC=/usr/bin/clang pip install mitmproxy]1;pipDownloading/unpacking mitmproxy
@surma
surma / dnsimple
Last active December 17, 2015 21:48
#! /bin/sh
### BEGIN INIT INFO
# X-Start-Before: ssh
# Required-Start: $local_fs $network $syslog
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
### END INIT INFO
case "$1" in
x.forEach(function(val){
var tmp = val.split(";");
var min = [5000, 5000];
var max = [0, 0];
var idx = 0;
tmp[0].split(",").forEach(function(val) {
val = parseInt(val);
if(val < min[idx]) {
min[idx] = val;
}
@surma
surma / json.rl
Created June 14, 2013 13:46
Ragel Json Parser
// Some playing around with ragel.
// Install ragel (e.g. `brew install ragel`)
// Compile with `ragel -Z json.rl`
package main
import (
"fmt"
)
// Ragel expects these variables to be declared in the host program
@surma
surma / Dockerfile
Created June 18, 2013 12:09
Docker Buildfile for a Ubuntu system with go1.1.1 installed
FROM ubuntu
MAINTAINER Alexander Surma <surma@surmair.de>
RUN echo "deb http://archive.ubuntu.com/ubuntu precise main universe" > /etc/apt/sources.list
RUN apt-get update
RUN apt-get install -y git mercurial bzr wget
RUN wget -O - https://go.googlecode.com/files/go1.1.1.linux-amd64.tar.gz | tar xzf - -C /usr/local
RUN (echo "export PATH=/usr/local/go/bin:\$PATH"; echo "export GOPATH=$HOME"; cat /etc/bash.bashrc) > /root/tmp