Skip to content

Instantly share code, notes, and snippets.

@ajstarks
ajstarks / 2dtest.go
Created November 26, 2010 06:33
Comparison of draw2d and SVGo
package main
import (
"os"
"fmt"
"math"
"github.com/ajstarks/svgo"
)
var (
@ajstarks
ajstarks / gist:1407688
Created November 30, 2011 02:17
Update to utils.go from the conditions package
/*
utils - General functions common to all three utils.
Written and maintained by Stephen Ramsay
Last Modified: Sun Nov 27 14:04:35 CST 2011
Copyright © 2011 by Stephen Ramsay
@ajstarks
ajstarks / gist:3044339
Last active October 6, 2015 19:48
Getting the width and height of jpg and png images
package main
import (
"fmt"
"image"
_ "image/jpeg"
_ "image/png"
"os"
)
@ajstarks
ajstarks / gist:3133235
Created July 18, 2012 00:40
gospeed test on the Raspberry Pi: Raspbian pisces hardware float distribution
raspbian@pisces:~/gowork/src/github.com/feyeleanor/gospeed$ go test -test.bench=".*"
PASS
BenchmarkBaselineCastInt32ToInt 100000000 13.5 ns/op
BenchmarkBaselineCastIntToInt32 100000000 13.5 ns/op
BenchmarkBaselineCastInt64ToUint64 100000000 17.8 ns/op
BenchmarkBaselineCastUint64ToInt64 100000000 17.2 ns/op
BenchmarkBaselineVariableGet 100000000 13.4 ns/op
BenchmarkBaselineVariableSet 100000000 22.4 ns/op
BenchmarkBaselineVariableGetInterface 100000000 13.5 ns/op
BenchmarkBaselineVariableSetInterface 50000000 31.3 ns/op
// shapes: minimal program to explore OpenVG
// Anthony Starks ([email protected])
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>
#include "VG/openvg.h"
#include "VG/vgu.h"
#include "EGL/egl.h"
@ajstarks
ajstarks / DejaVuSans.inc
Created July 29, 2012 04:12
shapes: draw random shapes using OpenVG (Raspberry pi version)
/* Generated by font2openvg. See http://developer.hybrid.fi for more information. */
/* converted from font file /usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf */
/* font family name: DejaVu Sans */
/* font style name: Book */
static const unsigned char DejaVuSans_glyphInstructions[4753] = {
2,4,4,4,4,0,2,4,4,4,4,4,4,0,2,4,4,4,4,0,
2,4,4,4,4,0,2,4,4,4,4,0,2,4,4,4,4,4,4,4,
4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
@ajstarks
ajstarks / hellovg.go
Created September 3, 2012 02:42
OpenVG + Go
//
// first OpenVG program
// Anthony Starks ([email protected])
//
//
package main
import (
"fmt"
"github.com/ajstarks/openvg"
@ajstarks
ajstarks / ts.go
Last active October 10, 2015 22:28
Go Twitter Command line client
// ts -- twitter search
package main
import (
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"net/http"
@ajstarks
ajstarks / gist:3962507
Created October 27, 2012 00:52
wingo error log on the Raspberry Pi
[xgbutil] new.go:345: xgraphics expects that the root window has a depth of 24, but yours has depth '16'. Its possible things will still work if your value is 32, but will be unlikely to work with values less than 24. Please report this.
[xgbutil] new.go:357: xgraphics expects that the bits per pixel for the root window depth is 32. On your system, the root depth is 16 and the bits per pixel is 16. Things will most certainly not work. Please report this.
[xgbutil] new.go:365: Please report the aforementioned error message(s) at https://github.com/BurntSushi/xgbutil. Please also include the entire output of the `xdpyinfo` command in your report. Thanks!
[xgbutil] new.go:345: xgraphics expects that the root window has a depth of 24, but yours has depth '16'. Its possible things will still work if your value is 32, but will be unlikely to work with values less than 24. Please report this.
[xgbutil] new.go:357: xgraphics expects that the bits per pixel for the root window depth is 32. On your system, the root dep
@ajstarks
ajstarks / gist:5574088
Last active December 17, 2015 07:39
Go Build and test times
Go 1.1 Build and test times
System all.bash test pkg ../test go build ts.go
(all times seconds)
Macbook Air (2 Ghz Core i7) 170.0 35.13 45.48 0.623
MacBook Pro (2.53 GHz Core 2 Duo) 274.0 71.9 79.0 0.977
Raspberry Pi Model B 5284.0 1209.42 2174.0 9.78
Beaglebone Black (USB Power) 6360.0 1463.0 2691.0 12.68