Skip to content

Instantly share code, notes, and snippets.

enum Style{
EU = 1,
AM = 2
};
enum Payoff{
PUT = 1,
CALL = 2
};
package main
import (
"crypto/rand"
"encoding/binary"
"flag"
"fmt"
"io"
"log"
"math"
@feribg
feribg / latency.txt
Created September 25, 2015 19:18 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@feribg
feribg / test.php
Last active September 15, 2015 01:10
<?php
$arr1 = [[1,2,[3]],4];
$arr1_test = [1,2,3,4];
$arr2 = [3,[4,5,[6],7],8];
$arr2_test = [3,4,5,6,7,8];
/**
* Given an array $arr and a new array $res, this function would flatten $arr into $res using recursion.

Keybase proof

I hereby claim:

  • I am feribg on github.
  • I am feribg (https://keybase.io/feribg) on keybase.
  • I have a public key whose fingerprint is 7160 9099 44D4 AD55 7AD7 26CA C0BB EE83 EEBF B84D

To claim this, I am signing this object:

@feribg
feribg / m3u generator
Created December 29, 2013 19:15
Simple snippet to generate m3u files from all mp3 files in a folder
find . -name '*.mp3' -execdir bash -c 'file="{}"; printf "%s\n" "${file##*/}" >> "${PWD##*/}.m3u"' \;