Skip to content

Instantly share code, notes, and snippets.

View gudmundur's full-sized avatar

Guðmundur Bjarni Ólafsson gudmundur

View GitHub Profile
print u'Congratulations Master Jóhann'
@gudmundur
gudmundur / benchmark.log
Last active August 29, 2015 14:01
Simple throughput benchmark in Go
# Ran this on my 2014 MBA 13" 1.7 GHz i7, 8GB Ram.
$ go version
go version go1.2.1 darwin/amd64
$ go build go-web.go
$ GOMAXPROCS=4 ./go-web &
$ wrk -t10 -c400 http://localhost:8080
Running 10s test @ http://localhost:8080
10 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 4.72ms 1.33ms 47.42ms 95.49%
package main
import "fmt"
import "io/ioutil"
import "net/http"
import "encoding/json"
type CurrencyResult struct {
Currencies []Currency `json:"results"`
}
09:04:03.920861 IP 10.0.0.134 > 10.0.1.202: VRRPv2, Advertisement, vrid 10, prio 101, authtype simple, intvl 1s, length 16
09:04:04.922004 IP 10.0.0.134 > 10.0.1.202: VRRPv2, Advertisement, vrid 10, prio 101, authtype simple, intvl 1s, length 16
package main
import (
"fmt"
"encoding/json"
"io/ioutil"
_ "github.com/lib/pq"
_ "database/sql"
@gudmundur
gudmundur / Gruntfile.js
Last active December 16, 2015 20:48
Gruntfile for re-running xelatex on any .tex change.
module.exports = function(grunt) {
grunt.initConfig({
watch: {
latex: {
files: ['**/*.tex'],
tasks: ['exec:xelatex']
}
},
exec: {
[
{
"route": 15,
"times": ["12:24","12:54","13:24","13:54","14:24","14:54","15:24","15:54","16:24","16:54","17:24","17:54","18:24","18:54","19:24","19:54","20:24","20:54","21:24","21:54","22:24","22:54","23:24"],
"source":"estimated",
"endStop":{"location":[64.1471469996301,-21.9633719999683],"stopId":"90000116","longName":"Meistaravellir","shortName":"Meistaravellir"},
"stop":{"location":[64.1693779999662,-21.7151469991191],"stopId":"16040637","longName":"Álfatangi / Arnartangi","shortName":"Arnartangi"}
}
]
@gudmundur
gudmundur / hn.coffee
Created June 6, 2012 11:59
Server-Side scraping with jQuery, jsdom and node.js
fs = require 'fs'
jsdom = require 'jsdom'
{ zip } = require 'underscore'
jquery = fs.readFileSync 'lib/jquery-1.7.2.min.js'
story = ($, [title, subtext]) ->
$t = (selector) -> $ selector, title
$s = (selector) -> $ selector, subtext
@gudmundur
gudmundur / gist:1696305
Created January 28, 2012 23:45
Strætó Rauntímakort
qs = require 'querystring'
request = require 'request'
cradle = require 'cradle'
http = require 'http'
client = new cradle.Connection
db = client.database 'bus-realtime'
url = "http://www.straeto.is/bitar/bus/livemap/json.jsp"