Skip to content

Instantly share code, notes, and snippets.

// seam: resize images using seam carving
package main
import (
"flag"
"fmt"
"image"
"image/png"
"image/gif"
"image/jpeg"
# Go 1.6.2 ---
chip@chip:~/go/test/bench/go1$ go test -bench=.
testing: warning: no tests to run
PASS
BenchmarkBinaryTree17 1 50504170115 ns/op
BenchmarkFannkuch11 1 43940678986 ns/op
BenchmarkFmtFprintfEmpty 2000000 639 ns/op
BenchmarkFmtFprintfString 500000 3664 ns/op
@ajstarks
ajstarks / gist:fa05919377de73a552870ce9e45e4844
Last active August 2, 2016 00:18
Pine64 Go1 Benchmarks
# go 1.6.2
ajstarks@localhost:~/go/test/bench/go1$ go test -bench=.
testing: warning: no tests to run
PASS
BenchmarkBinaryTree17-4 1 31246864000 ns/op
BenchmarkFannkuch11-4 1 26586101000 ns/op
BenchmarkFmtFprintfEmpty-4 3000000 425 ns/op
BenchmarkFmtFprintfString-4 1000000 1750 ns/op
// structlayout-svg: generate SVG struct layouts
package main
import (
"encoding/json"
"flag"
"fmt"
"log"
"os"
package main
import (
"fmt"
"time"
)
func main() {
fmt.Println(<-time.After(time.Duration(60 - time.Now().Second()) * time.Second))
}
<deck>
<slide>
<text xp="10" yp="50" align="center" sp="2.5" color="maroon">Go Proverbs</text>
<text xp="25" yp="95.00" sp="1.6" align="left">Don’t communicate by sharing memory, share memory by communicating.</text>
<image xp="20" yp="96.00" width="300" height="300" scale="7" name="noun_skill-share_14291.png" />
<text xp="25" yp="89.8" sp="1.6" align="left">Concurrency is not parallelism.</text>
<image xp="20" yp="90.8" width="300" height="300" scale="7" name="noun_up-arrows_220576.png" />
<text xp="25" yp="84.6" sp="1.6" align="left">Channels orchestrate; mutexes serialize.</text>
<image xp="20" yp="85.6" width="300" height="300" scale="7" name="noun_pipes_61289.png" />
@ajstarks
ajstarks / spark.go
Last active November 18, 2015 16:41
Sparkline experiment
package main
import (
"github.com/ajstarks/svgo"
"os"
)
var canvas = svg.New(os.Stdout)
// sparkline defines the components of the sparkline:
@ajstarks
ajstarks / gist:a4e48ef7463372991d35
Created August 18, 2015 02:47
Raspberry Pi go1.5rc1all.bash failure (gpu_mem=16)
pi@raspberrypi ~ $ cd go
pi@raspberrypi ~/go $ cd src
pi@raspberrypi ~/go/src $ date
Mon Aug 17 19:56:02 EDT 2015
pi@raspberrypi ~/go/src $ date; ./all.bash; date
Mon Aug 17 19:56:21 EDT 2015
##### Building Go bootstrap tool.
cmd/dist
##### Building Go toolchain using /home/pi/go1.4.
@ajstarks
ajstarks / gist:06fa30721b03f442756f
Last active August 29, 2015 14:27
Digital Ocean go 1.5rc1 build transcript
ajstarks@ajstarks:~/go$ ls
api CONTRIBUTING.md doc lib misc README.md src VERSION
AUTHORS CONTRIBUTORS favicon.ico LICENSE PATENTS robots.txt test
ajstarks@ajstarks:~/go$ cd src
ajstarks@ajstarks:~/go/src$ time ./all.bash
##### Building Go bootstrap tool.
cmd/dist
##### Building Go toolchain using /home/ajstarks/go1.4.
bootstrap/internal/obj
package main
import (
"encoding/json"
"fmt"
"io"
"os"
"github.com/ajstarks/svgo"
)