Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Nick Bauman nickbauman

🎯
Focusing
View GitHub Profile
@nickbauman
nickbauman / go_vs_clojure_habits.txt
Last active Jul 8, 2017
Go vs. Clojure: Habits of Thinking
View go_vs_clojure_habits.txt
The goal is to insert an integer into an ordered list-like thingy.
Here's Go.
// Given g
g := []int{1, 2, 3, 4}
// Insert 44 in the middle of it
append(g[:2], append([]int{44}, g[2:]...)...)
View The Three Go Landmines.markdown

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@nickbauman
nickbauman / hb_posgres
Created Jun 25, 2012
Problems with homebrew installing postgress
View hb_posgres
brew --config
HOMEBREW_VERSION: 0.9
HEAD: fc0b4b636a366db1d66db216db380d9c2a4c7a82
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 64-bit penryn
OS X: 10.7.4
Kernel Architecture: x86_64
Xcode: 4.3.3, CLT 4.3.0.0.1.1249367152
GCC-4.0: N/A
@ibdknox
ibdknox / server.sh
Created Aug 4, 2011
example daemon for lein processes
View server.sh
#!/bin/bash
name=webnoir
pidfile=/var/run/$name.pid
if [ -f "$pidfile" ]; then
pid=`cat $pidfile`
running=`ps p $pid |wc -l`
if [ $running -eq 1 ]; then
pid=