This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"crypto/rand" | |
"fmt" | |
"testing" | |
) | |
func BenchmarkRandReads(b *testing.B) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"crypto/rand" | |
"strconv" | |
"testing" | |
) | |
func BenchmarkRandReads(b *testing.B) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"math" | |
) | |
func main() { | |
var f float64 = math.MaxInt64 + 1 | |
c := math.Ceil(f) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package raceexec | |
import ( | |
"log" | |
"os" | |
"os/exec" | |
"testing" | |
"time" | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
benchmark old ns/op new ns/op delta | |
BenchmarkRegister-4 1767 2250 +27.33% | |
BenchmarkUnregister-4 2956 3406 +15.22% | |
BenchmarkBroadcast/1-4 637 901 +41.44% | |
BenchmarkBroadcast/10-4 2022 2195 +8.56% | |
BenchmarkBroadcast/100-4 20755 20312 -2.13% | |
BenchmarkBroadcast/500-4 103296 104309 +0.98% | |
BenchmarkBroadcast/1000-4 191801 196909 +2.66% | |
BenchmarkBroadcast/10000-4 2539621 2751075 +8.33% | |
BenchmarkBroadcast/100000-4 45231751 49716303 +9.91% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Adds the currently playing iTunes track to your prepared commit message. | |
# | |
# To install, save in repo as chmod +x to .git/hooks/prepare-commit-msg | |
SONG=`osascript -e 'tell application "iTunes" to if player state is playing then "♬ : " & artist of current track & " / " & name of current track'` | |
if [[ $SONG ]]; then | |
echo -e "$(cat $1)\n\n$SONG" > $1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VirtualBox VM 5.0.2 r102096 darwin.amd64 (Aug 13 2015 18:38:03) release log | |
00:00:00.035033 Log opened 2015-08-20T12:17:55.276622000Z | |
00:00:00.035034 Build Type: release | |
00:00:00.035045 OS Product: Darwin | |
00:00:00.035050 OS Release: 14.5.0 | |
00:00:00.035055 OS Version: Darwin Kernel Version 14.5.0: Wed Jul 29 02:26:53 PDT 2015; root:xnu-2782.40.9~1/RELEASE_X86_64 | |
00:00:00.035143 DMI Product Name: MacBookPro12,1 | |
00:00:00.035189 DMI Product Version: 1.0 | |
00:00:00.035195 Host RAM: 16384MB total, 7593MB available | |
00:00:00.035197 Executable: /Applications/VirtualBox.app/Contents/MacOS/VBoxHeadless |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A very common pattern in Elixir is to define a method that pipes the first | |
# argument through a series of transformations, for example here is some actual | |
# Elixir code I just wrote. | |
@spec encode(String.t) :: String.t | |
def encode(plaintext) do | |
plaintext | |
|> encipher | |
|> chunk | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ERROR: MultiJson::DecodeError occured in stream |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'json' | |
require 'oj' | |
require 'msgpack' | |
require 'benchmark' | |
################################# | |
# set up sample data | |
################################# | |
def hash2array(hash) |
NewerOlder