Skip to content

Instantly share code, notes, and snippets.

View aybabtme's full-sized avatar
👶
I may be slow to respond. Newborn in the house.

Antoine Grondin aybabtme

👶
I may be slow to respond. Newborn in the house.
View GitHub Profile
package main
func main() {
println("lol")
}
package monotoneulid
import (
"errors"
"io"
"github.com/oklog/ulid"
)
// Generator generates ULIDs that are strictly monotonically increasing, even
@aybabtme
aybabtme / gist:5944471
Last active March 22, 2017 22:49
dskvs vs. diskv on EC2

Benchmarking dskvs against diskv on a SSD does not return usable data. For the small sized data-set (10'000 entries) on which the benchmark runs, the SSD serve diskv from its cache.

To find out the difference in performance between dskvs and diskv, I've run the same benchmark again on an EC2 t1.micro instance. Here are the results:

                           ============= dskvs ==========       =========== diskv ==========
BenchmarkPut32B    50000    104995 ns/op        0.30 MB/s       126290 ns/op       0.25 MB/s
BenchmarkPut1KB    50000    103398 ns/op        9.90 MB/s       103049 ns/op       9.94 MB/s
BenchmarkPut4KB    10000    187640 ns/op       21.83 MB/s       101553 ns/op      40.33 MB/s
package main
import (
"log"
"time"
)
func main() {
nobodyListening := make(chan struct{})
package main
import (
"log"
"time"
)
func main() {
nobodyListening := make(chan struct{})
{
// you may set specific environment variables here
// e.g "env": { "PATH": "$HOME/go/bin:$PATH" }
// in values, $PATH and ${PATH} are replaced with
// the corresponding environment(PATH) variable, if it exists.
"env": {
"GOPATH": "$HOME/gocode"
},
// Your shell. e.g. on Linux and OS X, if your shell bash:
@aybabtme
aybabtme / wishful_thinking.go
Created January 11, 2014 15:38
wishful_thinking.go
func DreamWayOfDoingIt() {
clientPool := NewAWSPool(awsCredentials, aws.T1Micro, aws.USEast, 30)
serverPool := NewAWSPool(awsCredentials, aws.T1Micro, aws.China, 30)
Join(clientPool, serverPool).RunNow(func(h Host) []string {
return []string{
"sudo apt-get update",
"sudo apt-get upgrade -y",
"sudo apt-get install -y mercurial git bzr gcc",
"hg clone -u release https://code.google.com/p/go",
var schedule = function(taskArr) {
// 1st step: sort data by gain (from max to min)
var sortedByGain = insertionSort(taskList, "gain");
var n = sortedByGain.length;
var timeSlot = new Array();
// 2nd step: number the jobs 1,2,3,..,n, then
for (var i = 0; i < n; i++) {
var task = sortedByGain.pop()
#!/usr/bin/env Rscript
# install.packages(gregmisc)
require("gregmisc")
allPerm <- permutations(n = 5, r = 2, v = 0:4, repeats.allowed=TRUE)
allXY <- data.frame(allPerm)
colnames(allXY) <- c("X", "Y")
f_XY <- function(x, y) {