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
@aybabtme
aybabtme / matrix_mul.js
Created November 20, 2013 17:38
Strassen Matrix Multiplication in Javascript
// Scalar stuff
var Scalar = {};
(function () {
"use strict";
Scalar.mulFunc = function (first, second) {
return first * second;
};
double[] genVArr(int n, double timeStep, int[] configuration) {
double[] output = new double[n];
double currentTime = timeStep;
for (int i = 0; i < n; i++) {
output[i] = v(currentTime, configuration)
currentTime += timeStep;
}
return output;
}
@aybabtme
aybabtme / to_buffer_or_not_to_buffer.go
Last active December 27, 2015 15:39
Quick measurement of performance given various buffering size when reading/writing a file sequentially. For demo purpose.
package main
import (
"bytes"
"encoding/json"
"fmt"
"github.com/dustin/go-humanize"
"github.com/gonum/plot"
"github.com/gonum/plot/plotter"
"github.com/gonum/plot/plotutil"
<!DOCTYPE html>
<html>
<head>
<title>Value cannot be null.<br>Parameter name: s</title>
<meta name="viewport" content="width=device-width" />
<style>
body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;}
p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px}
b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px}
H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red }

Comment Aller Au Viet Nam

[English version here][eng].

Un petit guide de trucs de base que vous devriez savoir.

Vous devriez être capable de communiquer en anglais pour aller au Viet Nam, les gens ne parlent pas français là-bas. Certains pensent que parce que c'est une ancienne colonie française, les gens parlent français. Non, sauf quelques rares exceptions.

Préambule

Le Viet Nam est un pays en voie de développement, donc il y a plusieurs chose qui vont avoir l'air louche quant vous allez procéder à vous rendre là, ainsi que quand vous allez être là.

@aybabtme
aybabtme / gist:7094937
Last active December 26, 2015 04:39
How To Get In Viet Nam

How To Get In Viet Nam

La [version française est ici][french].

Here I write quickly about the basics you should be aware of.

Background

Viet Nam is a developing country, so there are a lot of things that will look sketchy to you when dealing with getting there, and once you get there.

Also, if you've never been in a developing country before, you might want to read a bit about Viet Nam before getting there. There are many things you take for granted as normal behaviour that aren't necessarily something you should do there. For instance:

package main
import (
"bytes"
"fmt"
"strconv"
)
type Node struct {
next *Node
@aybabtme
aybabtme / Main.java
Created October 10, 2013 03:27
Pseudo functional programming in Java
public class Main {
// Pseudo lambda
public interface Operation {
double apply(double arg);
}
// Takes in pseudo-lambda
public static double times(Operation toApply, int times) {
double result = 1.0;
package main
import (
"strconv"
"testing"
)
func Benchmark_LookupBeforeWrite_FullMap(b *testing.B) {
testMap := fillWholeMap(b.N)
@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