Skip to content

Instantly share code, notes, and snippets.

@nf
nf / gist:3896660
Created October 16, 2012 00:51
A journey from Sydney Domestic Airport to Central Station illustrated with ping
% ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=3980.438 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=54 time=2979.361 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=54 time=1978.766 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=54 time=978.429 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=54 time=114.190 ms
@nf
nf / gist:3896766
Created October 16, 2012 01:27
A journey from Sydney Domestic Airport to Central Station illustrated with ping
% ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
64 bytes from 8.8.8.8: icmp_seq=0 ttl=54 time=3980.438 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=54 time=2979.361 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=54 time=1978.766 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=54 time=978.429 ms
64 bytes from 8.8.8.8: icmp_seq=4 ttl=54 time=114.190 ms
@nf
nf / conv.go
Created November 2, 2012 13:25
script to convert go tour html to present file format
package main
import (
"bytes"
"exp/html"
"fmt"
"io/ioutil"
"log"
"os"
"regexp"
@nf
nf / gist:4255933
Created December 11, 2012 04:44
new playground api interpreter
<input type="button" value="Stop" id="stop">
<div id="log"></div>
<script src="go/doc/jquery.js"></script>
<script>
var script = [
{"Delay": 0, "Message": "Hello, "},
{"Delay": 1000000000, "Message": "World!\n"},
{"Delay": 2000000000, "Message": "That's it!"}
];
function playback(root, script) {
@nf
nf / conv.go
Created January 23, 2013 23:47
// Before pulling the latest changes from the go repository, first
// run this tool:
// cd go-tour
// go build -o conv conv.go
// ./conv < static/index.html
// It will create tour.article and a prog directory full of .go files.
// Read over tour.article and check that it makes sense.
// You will probably want to:
// hg pull -u
// go get -u code.google.com/p/go.talks/pkg/present
package main
import (
"bufio"
"log"
"fmt"
"os"
"regexp"
)
@nf
nf / gist:6076798
Created July 25, 2013 03:56
Go package line counts
69173 syscall
48635 runtime
17797 net
15842 net/http
11672 crypto/tls
9402 math
9284 unicode
8416 reflect
8322 math/big
7808 encoding/gob
package main
import (
"flag"
"log"
"net/http"
"strings"
"sync"
"time"
@nf
nf / vm-setup.sh
Last active June 14, 2023 22:08
Script for setting up Debian Jessie VM with my development environment
#!/bin/bash -e
echo '
PATH=$HOME/go/bin:$PATH
export GOPATH=$HOME
export CDPATH=.:$HOME/src/golang.org/x:$HOME/go/src:$HOME/src/github.com:$HOME/src/github.com/nf:$HOME/src/github.com/adg
export EDITOR=vim
' >> ~/.profile
sudo apt-get update
#!/bin/bash -e
echo '
PATH=$HOME/go/bin:$PATH
export GOPATH=$HOME
export CDPATH=.:$HOME/src/golang.org/x:$HOME/go/src:$HOME/src/github.com:$HOME/src/github.com/nf:$HOME/src/github.com/adg
export EDITOR=vim
' >> ~/.profile
sudo apt-get update