Skip to content

Instantly share code, notes, and snippets.

@kylelemons
kylelemons / enum.go
Created September 8, 2011 18:49
Enum types (bitshifted too)
package main
import (
"fmt"
"strings"
)
type foo int
const (
One foo = iota
@kylelemons
kylelemons / Makefile
Created August 3, 2011 17:21
A demonstration listener in Go
include $(GOROOT)/src/Make.inc
TARG=l
DEP=
GOFILES=\
main.go\
pkgdir=$(GOROOT)/pkg/$(GOOS)_$(GOARCH)
PREREQ+=$(foreach PKG,$(DEP),$(pkgdir)/$(PKG).a)
@kylelemons
kylelemons / scripttemplate.sh
Created July 19, 2011 22:52
BASH Script template
###
### Usage: blah [<options>]
###
### Description of the script
###
### Options:
### -f --flag
### Description of the flag
### -o --option <arg>
### Description of the option and argument
@kylelemons
kylelemons / reman.go
Created June 7, 2011 00:44
A sketch of a resource manager in Go
package main
import (
"fmt"
"time"
"sync"
)
// A Token represents resources allocated. It must be given
// back to the Manager to free the resource.