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
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
#/etc/security/limits.conf | |
* hard nofile 1024000 | |
* soft nofile 1024000 | |
root hard nofile 1024000 | |
root soft nofile 1024000 |
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
public class Is2Power { | |
public static void main(String[] args) { | |
for (int i = 0;i <= 1024; i++) { | |
if ((i & -i) == i) | |
System.out.println(Integer.toBinaryString(i) + ", " + Integer.toBinaryString(-i) + " " + i); | |
} | |
} | |
} |
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
(defn distincto | |
"s is a sequence of sequence of vars. | |
ensure that vars in each particular sequence | |
take on distinct values." | |
[s] | |
(if (seq s) | |
(let [vars (first s)] | |
(all | |
(distinctfd vars) | |
(distincto (next s)))) |
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
(defn- crc32 | |
"Generate a crc32 checksum for the given string" | |
[token] | |
(let [hash-bytes | |
(doto (java.util.zip.CRC32.) | |
(.reset) | |
(.update (.getBytes token)))] | |
(Long/toHexString (.getValue hash-bytes)))) |
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
def mysum(*args): | |
return sum(args) | |
def mytimes(*args): | |
if not args: | |
return 0 | |
else: | |
result = 1 | |
for v in args: | |
result *= v |
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 ( | |
"crypto/rand" | |
"fmt" | |
"io" | |
) | |
func newId(size int) string { | |
k := make([]byte, size) |
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
import java.io.BufferedReader; | |
import java.io.File; | |
import java.io.FileInputStream; | |
import java.io.FileNotFoundException; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.lang.reflect.Field; | |
import java.lang.reflect.Method; | |
import org.slf4j.Logger; |
OlderNewer