Skip to content

Instantly share code, notes, and snippets.

@dustin
dustin / gosh2.go
Last active December 18, 2015 15:08
A web server to trigger shell scripts. Each script is run at least once per request. Typically not more than that.
package main
import (
"flag"
"log"
"net/http"
"os"
"os/exec"
"path/filepath"
)
@dustin
dustin / gerrit.py
Created June 17, 2013 18:50
Stream the gerrit stuff.
#!/usr/bin/env python
#
# Run this under a supervisor to make the stream go from gerrit to a
# couchdb.
#
# Set the following environment variables to make for useful:
#
# COUCH_SERVER - url to CouchDB ( e.g. http://localhost:5984/ )
# COUCH_DB - db to contain the stuff (e.g. gerrit)
# GERRIT_HOST - hostname of review server (e.g. review.membase.org)
@dustin
dustin / output
Created May 20, 2013 00:09
cbfsclient info
nodes:
bruce up 98h27m43.642659968s (age: 3.639871788s)
bsd2 up 99h2m1.141693362s (age: 1.128633809s)
dbsd up 99h1m35.182252858s (age: 169.206832ms)
dogbowl up 98h59m50.224614808s (age: 222.789735ms)
mini64 up 99h0m16.659057991s (age: 1.655205815s)
tasks:
bruce
reconcile - running - 2013-05-20 00:08:29.939011817 +0000 UTC
@dustin
dustin / tcpproxy.go
Last active March 20, 2025 00:47
hex dumping tcp proxy
package main
import (
"encoding/hex"
"flag"
"io"
"io/ioutil"
"log"
"net"
"os"
@dustin
dustin / gosh.go
Last active December 16, 2015 10:59
A web server that runs a shell script. I use this for simple build automation kinds of things.
package main
import (
"flag"
"log"
"net/http"
"os/exec"
)
func runner(ch chan bool, cmd string, args ...string) {
@dustin
dustin / caperturber.go
Last active December 16, 2015 05:19
Example rate limited writer in go. Specify bytes per second and it will constrain you.
// This is just a creepy text effect over a writer just to demonstrate
// more io layering.
package main
import (
"io"
"math/rand"
"unicode"
"unicode/utf8"
@dustin
dustin / gist:4955187
Created February 14, 2013 18:47
cbugg build script
#!/bin/sh -e
export GOPATH=$HOME/go
export PATH=/bin:/usr/bin:/usr/local/bin:$HOME/go/bin:$HOME/prog/go/bin
cd $HOME/go/src/github.com/couchbaselabs/cbugg
git fetch origin
if git diff --name-only origin/master | fgrep -q .go
@dustin
dustin / handraiser.go
Created December 14, 2012 18:18
Based on phone home data, build an extrusion map.
package main
import (
"archive/zip"
"flag"
"log"
"os"
"text/template"
"time"
@dustin
dustin / cbstatkml.go
Created December 13, 2012 20:50
Builds the "extrusion" kmz thing.
package main
import (
"archive/zip"
"flag"
"fmt"
"log"
"os"
"code.google.com/p/dsallings-couch-go"
@dustin
dustin / if_test.go
Created December 6, 2012 04:11
various "max" benchmarks in go
package main
import (
"testing"
)
type bigStruct struct {
a int
ba1, ba2, ba3, ba4 [8192]byte
}