Skip to content

Instantly share code, notes, and snippets.

View rafrombrc's full-sized avatar

Rob Miller rafrombrc

  • Mozilla Corp
  • Oakland, CA
View GitHub Profile
require("circular_buffer")
require("cjson")
-- 300 rows, 11 cols, 1s per row
cbuf = circular_buffer.new(300, 11, 1)
cbuf_idxs = {}
for i=2, 12, 1 do
cbuf_idxs[i-1] = cbuf:set_header(i-1, tostring(i), "sum")
end
@rafrombrc
rafrombrc / dice.go
Created July 2, 2014 22:12
throwing dice through a tcp socket
package main
import (
"flag"
"log"
"math/rand"
"net"
"strconv"
"strings"
)
@rafrombrc
rafrombrc / gist:9142016
Created February 21, 2014 19:47
When nil != nil, or lolgo
Code that's running:
outputError <- err
fmt.Println("t.connection (pre): ", t.connection)
if t.connection != nil {
fmt.Println("t.connection (post): ", t.connection)
fmt.Println("err: ", err)
t.connection.Close()
t.connection = nil