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/sh | |
TARGET=/usr/local/bin | |
CURRENT=$PWD | |
if [ -z "$1" ] ; then | |
echo "no specify the erlang folder argument" | |
exit | |
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
package main | |
import ( | |
"fmt" | |
) | |
func fib(i, j int) func() int { | |
return func() int { | |
i, j = j, i+j | |
return j |
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" | |
"time" | |
) | |
func WaitMany(a, b chan bool) { | |
for a != nil || b != nil { | |
select { |
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
L1 cache reference 0.5 ns | |
Branch mispredict 5 ns | |
L2 cache reference 7 ns | |
Mutex lock/unlock 25 ns | |
Main memory reference 100 ns | |
Compress 1K bytes with Zippy 3,000 ns | |
Send 2K bytes over 1 Gbps network 20,000 ns | |
Read 1 MB sequentially from memory 250,000 ns | |
Round trip within same datacenter 500,000 ns | |
Disk seek 10,000,000 ns |
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" | |
"io/ioutil" | |
"log" | |
"math/rand" | |
"os" | |
"runtime" | |
"runtime/debug" |
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 ( | |
"bytes" | |
"crypto/des" | |
"errors" | |
) | |
func PKCS5Padding(ciphertext []byte, blockSize int) []byte { | |
padding := blockSize - len(ciphertext)%blockSize |
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
using System; | |
public class MT19937 | |
{ | |
private const ulong N = 312; | |
private const ulong M = 156; | |
private const ulong MATRIX_A = 0xB5026F5AA96619E9L; | |
private const ulong UPPER_MASK = 0xFFFFFFFF80000000; | |
private const ulong LOWER_MASK = 0X7FFFFFFFUL; | |
private static ulong [] mt = new ulong[N+1]; |
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
export GOROOT=/home/steven/go | |
export GOPATH=/home/steven/work/go-project/ | |
export GOBIN=$GOROOT/bin | |
export PATH=.:$PATH:$GOBIN |
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/sh | |
# goagent service by Steven | |
# put this file in /etc/init.d/goagent | |
# sudo update-rc.d goagent defaults | |
start(){ | |
echo "start goagent" | |
sudo /home/steven/work/github.com/goagent/local/proxy.sh start | |
exit 0 |
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/sh | |
# ssdb service by Steven | |
# put this file in /etc/init.d/ssdb | |
# sudo update-rc.d ssdb defaults | |
start(){ | |
echo "start ssdb" | |
/usr/local/ssdb/ssdb-server -d /usr/local/ssdb/ssdb.conf | |
exit 0 |