Saturday, July 29, 2017

shadowsocks 搭建

参见
https://xfabs.github.io/2016/08/02/shadowsocks/


主要apt-get install python-pip
pip install shadowsocks


{
    "server":"0.0.0.0",
    "server_port":1111,
    "local_address": "127.0.0.1",
    "local_port:":1080,
    "password":"mima",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}


ssserver -c /etc/ss.json -d start
ssserver -c /etc/ss.json -d stop

https://blog.jamespan.me/posts/enable-tcp-bbr-on-google-cloud

一定要开启上面的bbr
sudo bash -c 'echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf'
sudo bash -c 'echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf'
sudo sysctl -p

Tuesday, July 25, 2017

Friday, July 21, 2017

快速排序golang

package main

import "fmt"

func qsort(data []int) {
if len(data) <= 1 {
return
}
mid, i := data[0], 1
head, tail := 0, len(data)-1
for i = 1; i <= tail; {
                if data[i] > mid {
data[i], data[tail] = data[tail], data[i]
tail--
} else {
data[i], data[head] = data[head], data[i]
head++
i++
}
                }
data[head] = mid
qsort(data[:head])
qsort(data[head+1:])
}
func main() {
fmt.Println("Hello, 世界")

a:=[]int{1,2,3}
qsort(a)
for x:=range(a){
fmt.Println(x)}
}

Thursday, July 6, 2017

scala错误

java.lang.NoSuchMethodError: scala.runtime.IntRef.create(I)Lscala/runtime/IntRef

scala版本问题