Skip to content

Instantly share code, notes, and snippets.

@ajstarks
ajstarks / build-test-go
Last active December 18, 2015 19:09
Build and test Go from source
gover=go1.1.1 # update as needed
cd # I build go from my home directory
sudo apt-get install git # needed for go get
sudo apt-get install mercurial # also needed for some go-gettable packages
wget --quiet --output-document - https://go.googlecode.com/files/${gover}.src.tar.gz | tar xz # download, unpack source
cd go/src # move to the source directory
./all.bash # build and test
@ajstarks
ajstarks / gist:11200992
Created April 23, 2014 02:31
Output of go build -gcflags=-w for hello.go (Go 1.2.1)
output of go build -gcflag=-w when compiling hello.go (Go 1.2.1)
# command-line-arguments
walk [100232bf8]
. NAME-fmt.Println u(1) a(1) l(4) x(0+0) class(PFUNC) tc(1) used(1) FUNC-funcSTRUCT-(FIELD-
. . NAME-fmt.a·3 u(1) a(1) l(4) x(0+0) class(PPARAM) f(1) ARRAY-[]INTER-interface {} ...INTER-interface {} "esc:0x0") STRUCT-(FIELD-
. . NAME-fmt.n·1 u(1) a(1) l(4) x(24+0) class(PPARAMOUT) f(1) int int, FIELD-
. . NAME-fmt.err·2 u(1) a(1) l(4) x(32+0) class(PPARAMOUT) f(1) error error)
walk [100255d40]
. LITERAL-"hello, world" u(1) a(1) l(8) tc(1) string
@ajstarks
ajstarks / gist:11201007
Created April 23, 2014 02:32
Output of go build -gcflags=-w for hello.go (Go 1.3beta1)
# command-line-arguments
walk [100363848]
. NAME-main.autotmp_0000 u(1) a(1) l(8) x(0+0) class(PAUTO) esc(N) tc(1) used(1) string
walk [1003620d0]
. LITERAL-"hello, world" u(1) a(1) l(8) tc(1) string
walk [100364300]
. AS u(2) l(8) tc(1)
. . NAME-main.autotmp_0000 u(1) a(1) l(8) x(0+0) class(PAUTO) esc(N) tc(1) used(1) string
. . LITERAL-"hello, world" u(1) a(1) l(8) tc(1) string
walk [10033dd78]
sudo python -m smtpd -n -c DebuggingServer localhost:25
@ajstarks
ajstarks / gist:3211380054f996fa0828
Created June 21, 2014 14:35
OpenVG character map
package main
import (
"bufio"
"github.com/ajstarks/openvg"
"os"
"fmt"
)
func main() {
@ajstarks
ajstarks / makeslides.go
Created July 5, 2014 08:48
Slide generation example
package main
import (
"os"
"github.com/ajstarks/deck/generate"
)
func main() {
deck := generate.NewSlides(os.Stdout, 0, 0)
deck.StartDeck() // start the deck
@ajstarks
ajstarks / slidegen.go
Last active August 29, 2015 14:03
Slide generation experiments
package main
import (
"fmt"
"github.com/ajstarks/deck/generate"
"image"
"bufio"
_ "image/jpeg"
_ "image/png"
"strings"
func cube(d *generate.Deck, x, y, w, h float64, color string) {
xc := make([]float64, 4)
yc := make([]float64, 4)
w2 := w/2
h5 := h * .2
yh := y+h
xc[0], xc[1], xc[2], xc[3] = x-w2, x, x+w2, x
yc[0], yc[1], yc[2], yc[3] = yh-h5, yh, y-h5, yh-(y5*2)
// cube makes a cube with its front-facing bottom edge at x,y, lit from the top
func cube(d *generate.Deck, x, y, w, h float64, color string) {
xc := make([]float64, 4)
yc := make([]float64, 4)
w50 := w/2
h20 := h * .2
h40 := h20 * 2
yh := y+h
// gift: command line interface to Go image filtering toolkit
// please go to http://github.com/ajstarks/gift for the latest
package main
import (
"flag"
"fmt"
"image"
"image/color"
"image/jpeg"