Shadowsocks配置

安装服务端:

sudo pip install shadowsocks

==========================

服务端配置:


vim /etc/shadowsocks.json

{
    "server":"xx.xx.xx.xx",
    "server_port":8388,
    "password":"xxxxxxxxxx",
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}


启动:ssserver -c /etc/shadowsocks.json
后台启动:ssserver -c /etc/shadowsocks.json -d start
关闭:ssserver -c /etc/shadowsocks.json -d stop
开机启动把命令写入/etc/rc.local文件里

==========================

客户端win:

点击这里下载客户端
然后打开按里面的界面配置就好了

==========================

客户端linux:

安装: sudo pip install shadowsocks


vim /etc/shadowsocks.json

{
    "server":"xx.xx.xx.xx",
    "server_port":8388,
    "password":"xxxxxxxxxxxx",
    "local_address": "127.0.0.1",
    "local_port":1080,
    "timeout":300,
    "method":"aes-256-cfb",
    "fast_open": false
}

启动:sslocal -c /etc/shadowsocks.json
后台启动:sslocal -c /etc/shadowsocks.json -d start
关闭:sslocal -c /etc/shadowsocks.json -d stop
开机启动把命令写入/etc/rc.local文件里

==========================

SwitchySharp配置(只有linux需要,win直接全局代理就好了)

只填SOCKS 代理那行,127.0.0.1:1080
并且选择SOCKS v5

==========================

linux下命令行使用shadowsocks(proxychains)

安装: apt-get install proxychains
只把[ProxyList]下面的socks4那行删掉改成


[ProxyList]
socks5  127.0.0.1 1080

不要按官方的说明改,反正我按官方的改不行
附:官方说明

=========================

测试下是否可用:


proxychains curl http://www.twitter.com

Python for 的运用

#一、enumerate

#二、dict items iteritems

##一、enumerate:


dict_a = {"a":1,"b":2}
for k,v in enumerate(dict_a):
    print k,v 
结果:
0 a
1 b


sli = ["a","b","c"]
for k,v in enumerate(sli):
    print k,v
结果:
0 a
1 b
2 c

结论:enumerate是每个元素的k返回的是每个元素的位置,v是元素的值

##二、dict items iteritems:


dict_a = {"a":1,"b":2}
for (k,v)in dict_a.items():
     print k,v
结果:
a 1
b 2

for k,v in dict_a.iteritems():
    print k,v
结果:
a 1
b 2

items和iteritems 都可以遍历出 键和值,
items函数返回的是键值对的元组的列表,而iteritems使用的是键值对的generator。