Skip to content

Instantly share code, notes, and snippets.

View metakeule's full-sized avatar
💭
I may be slow to respond.

metakeule metakeule

💭
I may be slow to respond.
  • Asunción / Paraguay
View GitHub Profile
@cwestin
cwestin / aggregation.js
Created November 28, 2011 19:12
Mongo shell script and sample documents used for my aggregation talks 12/2011
// make sure we're using the right db; this is the same as "use aggdb;" in shell
db = db.getSiblingDB("aggdb");
// simple projection
var p1 = db.runCommand(
{ aggregate : "article", pipeline : [
{ $project : {
tags : 1,
pageViews : 1
}}
anonymous
anonymous / db.go
Created January 24, 2012 17:39
Go SDK for Dropbox
package dropbox
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strconv"
@jboner
jboner / latency.txt
Last active May 3, 2024 01:00
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@artisonian
artisonian / .gitignore
Last active March 21, 2024 20:13
go-eventsource
eventsource
go-eventsource
client/client
@adharris
adharris / postgres_array.go
Created November 28, 2012 19:52
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"
@KartikTalwar
KartikTalwar / Documentation.md
Last active April 13, 2024 23:09
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@minikomi
minikomi / persona.go
Last active December 11, 2015 06:59
mozilla persona test
package main
import (
"encoding/json"
"fmt"
"github.com/gorilla/sessions"
"io/ioutil"
"log"
"net/http"
"net/url"
@metakeule
metakeule / gist:4623836
Created January 24, 2013 16:02
combine methods and functions that have the same primary argument, i.e. handle methods that are defined with the object and functions that are defined afterwards for this object (in another library) the same way.
package main
import "fmt"
type Foo struct{}
func (f *Foo) Method() {
fmt.Println("Method")
}
type Funcs []func(*Foo)
@grafov
grafov / gist:5712165
Created June 5, 2013 07:22
golang sample of json/rpc over websocket
package main
import (
"code.google.com/p/go.net/websocket"
//"github.com/garyburd/go-websocket/websocket"
//"github.com/zhangpeihao/gowebsocket"
"net/http"
"net/rpc"
"net/rpc/jsonrpc"
)
@maliqq
maliqq / broker.go
Last active November 22, 2018 08:53
Golang message broker
package protocol
import (
"fmt"
"log"
)
// pubsub
type Broker struct {
Send map[string]*chan *Message