Skip to content

Instantly share code, notes, and snippets.

View tobstarr's full-sized avatar

Tobias Schwab tobstarr

View GitHub Profile
### Keybase proof
I hereby claim:
* I am tobstarr on github.
* I am tobstarr (https://keybase.io/tobstarr) on keybase.
* I have a public key whose fingerprint is 0C54 8BDF 08FC 12A7 4D3E 6CFC F789 030A 733B 094E
To claim this, I am signing this object:

Naming error variables in go

In the go source code I read lately I found that most often err is used when it comes to naming error variables. I personally always preferred plain e (mainly because it is 66.6% shorter).

To increase my code compatibility I decided to get some data about that. Two greps (powered by silversearcher) on the code in the stdlib later I had some numbers I could work with:

	/usr/local/go/src$ e=$(ag " e := " | wc -l); echo $e
	334
	/usr/local/go/src$ err=$(ag " err := " | wc -l); echo $err

4128

" install vundle with
" mkdir -p $HOME/.vim/bundle
" git clone https://github.com/gmarik/Vundle.vim.git $HOME/.vim/bundle/Vundle.vim
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'kien/ctrlp.vim'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-abolish'
Plugin 'majutsushi/tagbar' " requires exuberant-ctags
Bundle 'mileszs/ack.vim' " requires e.g. the_silver_searcher or silversearcher-ag
#!/bin/bash
abort() {
echo $1
exit 1
}
HOST=$1
PORT=$2
TIMEOUT=$3

Kibana in a box

VERSION=3.0.1 PORT=3000 go run kibana.go
@tobstarr
tobstarr / keybase.md
Created March 15, 2014 17:08
keybase.md

Keybase proof

I hereby claim:

  • I am tobstarr on github.
  • I am tobstarr (https://keybase.io/tobstarr) on keybase.
  • I have a public key whose fingerprint is B929 A94D 288F DB66 81D2 B958 FDE9 ED92 6EBC FE12

To claim this, I am signing this object:

bin_name = $(shell basename $$(pwd))
linux_bin_path = $(GOPATH)/bin/linux_amd64/$(bin_name)
default:
go get .
release:
rm -f $(linux_bin_path)
GOOS=linux GOARCH=amd64 go get .
cp $(linux_bin_path) $(bin_name).linux.amd64
@tobstarr
tobstarr / types.go
Created February 28, 2014 09:59
Cloudformation Golang DSL
package main
import (
"encoding/json"
"strings"
)
// base types
type Hash map[string]interface{}
type List []interface{}
#!/bin/bash
aws cloudformation create-stack --stack-name test-vpc --template-body file://vpc.json
mount: block device /dev/shm is write-protected, mounting read-only
mount: cannot mount block device /dev/shm read-only
dpkg: error processing initscripts (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of ifupdown:
ifupdown depends on initscripts (>= 2.88dsf-13.3); however:
Package initscripts is not configured yet.
dpkg: error processing ifupdown (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of procps: