Mar
15
2010

dig android

新购入了milestone,入了联通wcdma
终于成了android一族
milestone这款机器有点重,可以防身用,而且android菜场各种应用非常多,几乎看不到收费的,跟app store的几乎全部收费完全不同,我要用的功能都有前辈写完了,真不错。
经过两天使用,得出一个结论:wcdma真废流量!
呼噜噜一堆流量就没了,还是羡慕腐朽的资本主义国家啊,套餐便宜量又足
btw:手机屏幕大才是硬道理!

Mar
8
2010

great apps Company–google!

爱死google了,太牛叉了,google的sync太方便了

通过google sync for phone,我把我的S60手机的通讯录同步到google,然后跟我的ipod touch分享,接着又跟我的mac同步了。

通过google sync,我把我所有设备都同步了。

google还提供了伟大的push mail,我的sina邮箱可是要20/月,而这一切都是免费的。

google另外一个伟大的app就是google maps。我是一个经常出差的人,每到一个陌生的城市,打开google maps for mobile,我就能找到附近各个我想要的位置信息,而且通过基站定位,一般来说精确度在50m以内。

另外一个最常用的就是google的企业应用套件了,7g的容量,50个邮箱,日历,docs,chat,sites,当然企业套件每个账户都可以设置通过mobile访问,你能跟你的同事share这些应用!对于小于50人的公司,足够了!

最主要的,以上都是免费!

Mar
7
2010

change apache rewrite to nginx

全面从apache转向nginx了,可是对于某些程序.htaccess内的rewrite兼职深恶痛绝,没办法,找了个网站自动转,节约我的脑细胞了

http://www.anilcetin.com/convert-apache-htaccess-to-nginx/

Mar
3
2010

rain day

日子怎么过阿!

Mar
2
2010

ddwrt通过vpn反击域名劫持

基于大家都知道的原因,某党对一些特定域名进行了劫持,使得此区域内的人民无法访问这些网站。因为dns解析本身不是一个加密的传输过程,所以劫持域名是很easy的。这样一来,原本可以通过proxy,ssh tunnel等方式访问的这些网站由于无法获得正确的ip地址而无法访问。怎么办?

既然dns解析这个过程是不加密的,容易被劫持,那我们就把它变成加密的。那我们必须用vpn保证dns解析的传输在经过某党的GFW的时候是一个加密的数据,让它没辙。

我家用的路由器刷成了ddwrt,这样一来我就可以配置ddwrt,让它自动拨号到某一墙外的vpn server,然后通过指定路由表来保证对dns的访问是通过vpn的。

我们的dns server选用8.8.8.8

在ddwrt输入:ip route add 8.8.8.8 via 10.20.0.1(vpn网关)

输入netstat -rn可以看到如下路由表

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

8.8.8.8         10.20.0.1       255.255.255.255 UGH       0 0          0 ppp1

root@DD-WRT:~# traceroute 8.8.8.8

traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 38 byte packets

1 10.20.0.1 (10.20.0.1) 268.120 ms 267.180 ms 268.262 ms

对于8.8.8.8的访问都从远程vpn网关走了

Feb
27
2010

配置 Debian Server – snmp

apt-get install snmp snmpd

增加防火墙:

iptables -A INPUT -p udp -s serverip –dport 161 -j ACCEPT

启动后发现127.0.0.1:161,根据网上提示修改snmpd.conf文件,结果文件中没有

vi /etc/init.d/snmpd,发现/etc/default/snmpd文件中有SNMPDOPTS=’-Lsd -Lf /dev/null -u snmp -I -smux -p /var/run/snmpd.pid  127.0.0.1′

删除127.0.0.1后完成

vx:/etc/default# netstat -anp | grep 161
udp        0      0 0.0.0.0:161             0.0.0.0:*                           3470/snmpd
Feb
24
2010

配置 Debian Server – openvpn with mysql

apt-get install openvpn

openvpn常规配置参加其它

mysql -u root -p

create database vpn;

GRANT ALL ON vpn.* TO vpn@localhost IDENTIFIED BY ‘vpn123′;

flush privileges;

use vpn;

CREATE TABLE vpnuser ( name char(20) NOT NULL, password char(128) default NULL, active int(10) NOT NULL DEFAULT 1, PRIMARY KEY (name) );

insert into vpnuser (name,password) values(‘xhuang’,password(‘xhuang’));

vi /etc/pam.d/openvpn

auth sufficient pam_mysql.so user=vpn passwd=vpn123 host=localhost db=vpn \
table=vpnuser usercolumn=name passwdcolumn=password \
where=active=1 sqllog=0 crypt=2
account required pam_mysql.so user=vpn passwd=vpn123 host=localhost db=vpn \
table=vpnuser usercolumn=name passwdcolumn=password \
where=active=1 sqllog=0 crypt=2

需要自己编译openvpn-auth-pam.so

下载openvpn 2.0.9源码:wget http://openvpn.net/release/openvpn-2.0.9.tar.gz

apt-get install make gcc libpam0g-dev

cd openvpn-2.0.9/plugin/auth-pam

make

cp openvpn-auth-pam.so /etc/openvpn/

chmod 775 /etc/openvpn/openvpn-auth-pam.so

vi /etc/openvpn/openvpn.conf

port 443
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh1024.pem
server 10.8.0.0 255.255.0.0
push “redirect-gateway def1″
push “dhcp-option DNS 208.69.228.30″
push “dhcp-option DNS 4.2.2.1″
ifconfig-pool-persist ipp.txt
keepalive 10 120
tls-auth ta.key 0
plugin ./openvpn-auth-pam.so openvpn
client-cert-not-required
username-as-common-name
comp-lzo
max-clients 20
user nobody
group nobody
persist-key
persist-tun
status openvpn-status.log
verb 4
client:

client
dev tun
proto udp
remote ip 443
remote-random
resolv-retry infinite
nobind
persist-key
persist-tun
ca pca.crt
auth-user-pass
ns-cert-type server
tls-auth pta.key 1
comp-lzo
verb 4

Feb
24
2010

配置 Debian Server – PPTP VPN

apt-get install pptpd

vi /etc/pptpd.conf

localip 10.20.0.1
remoteip 10.20.0.100-200

vi /etc/ppp/pptpd-options

ms-dns 208.69.228.30
ms-dns 4.2.2.1

vi /etc/ppp/chap-secrets

username pptpd password *

vi /etc/sysctl.conf

net.ipv4.ip_forward=1

sysctl -p /etc/sysctl.conf

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

/etc/init.d/pptpd restart

Feb
24
2010

配置 Debian Server-nginx+mysql+php

http://www.howtoforge.com/installing-nginx-with-php5-and-mysql-support-on-debian-lenny

记住,千万不要用php5.3,否则就麻烦咯

Jan
26
2010

unixbench测试

1.VPS/openvz/192M/E5300/

INDEX VALUES
TEST                                        BASELINE     RESULT      INDEX
Dhrystone 2 using register variables        376783.7  5247702.6      139.3
Double-Precision Whetstone                      83.1      964.2      116.0
Execl Throughput                               188.3     4576.3      243.0
File Copy 1024 bufsize 2000 maxblocks         2672.0   105728.0      395.7
File Copy 256 bufsize 500 maxblocks           1077.0    35252.0      327.3
File Read 4096 bufsize 8000 maxblocks        15382.0   822425.0      534.7
Pipe-based Context Switching                 15448.6   215811.8      139.7
Pipe Throughput                             111814.6  1083985.5       96.9
Process Creation                               569.3    13649.9      239.8
Shell Scripts (8 concurrent)                    44.8      623.8      139.2
System Call Overhead                        114433.5   995473.2       87.0
=========
FINAL SCORE                                                     188.5

INDEX VALUES            TEST                                        BASELINE     RESULT      INDEX
Dhrystone 2 using register variables        376783.7  5247702.6      139.3Double-Precision Whetstone                      83.1      964.2      116.0Execl Throughput                               188.3     4576.3      243.0File Copy 1024 bufsize 2000 maxblocks         2672.0   105728.0      395.7File Copy 256 bufsize 500 maxblocks           1077.0    35252.0      327.3File Read 4096 bufsize 8000 maxblocks        15382.0   822425.0      534.7Pipe-based Context Switching                 15448.6   215811.8      139.7Pipe Throughput                             111814.6  1083985.5       96.9Process Creation                               569.3    13649.9      239.8Shell Scripts (8 concurrent)                    44.8      623.8      139.2System Call Overhead                        114433.5   995473.2       87.0                                                                 =========     FINAL SCORE                                                     188.5

2.VPS/XenVPS/128M/256swap/1*X3220

INDEX VALUES

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7  5954617.8      158.0

Double-Precision Whetstone                      83.1     1309.4      157.6

Execl Throughput                               188.3     1898.4      100.8

File Copy 1024 bufsize 2000 maxblocks         2672.0    54459.0      203.8

File Copy 256 bufsize 500 maxblocks           1077.0    15178.0      140.9

File Read 4096 bufsize 8000 maxblocks        15382.0   406666.0      264.4

Pipe Throughput                             111814.6   317361.7       28.4

Pipe-based Context Switching                 15448.6    91247.9       59.1

Process Creation                               569.3     4368.9       76.7

Shell Scripts (8 concurrent)                    44.8      528.6      118.0

System Call Overhead                        114433.5   271997.7       23.8

=========

FINAL SCORE                                                      96.7

3.dell 2950/Xeon 5130*2/4G/raid 0(2*146)

INDEX VALUES

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7 20154868.8      534.9

Double-Precision Whetstone                      83.1     1080.4      130.0

Execl Throughput                               188.3     8746.1      464.5

File Copy 1024 bufsize 2000 maxblocks         2672.0   146493.0      548.3

File Copy 256 bufsize 500 maxblocks           1077.0    38212.0      354.8

File Read 4096 bufsize 8000 maxblocks        15382.0  1363281.0      886.3

Pipe-based Context Switching                 15448.6   561180.6      363.3

Pipe Throughput                             111814.6  1515846.2      135.6

Process Creation                               569.3    27917.4      490.4

Shell Scripts (8 concurrent)                    44.8     1915.7      427.6

System Call Overhead                        114433.5  2119432.0      185.2

=========

FINAL SCORE                                                     353.1

4.dell 2850/Xeon 3.0*2/2g/raid5 (3*146)

INDEX VALUES

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7  8832282.0      234.4

Double-Precision Whetstone                      83.1      593.7       71.4

Execl Throughput                               188.3     5678.6      301.6

File Copy 1024 bufsize 2000 maxblocks         2672.0   102169.0      382.4

File Copy 256 bufsize 500 maxblocks           1077.0    30361.0      281.9

File Read 4096 bufsize 8000 maxblocks        15382.0   821021.0      533.8

Pipe-based Context Switching                 15448.6   236686.0      153.2

Pipe Throughput                             111814.6   981097.0       87.7

Process Creation                               569.3    17623.3      309.6

Shell Scripts (8 concurrent)                    44.8     1238.6      276.5

System Call Overhead                        114433.5  1283837.1      112.2

=========

FINAL SCORE                                                     211.3

5.ibm 365/Xeon 2.8*2/4G/raid5(4*146)

INDEX VALUES

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7  6704488.6      177.9

Double-Precision Whetstone                      83.1      517.7       62.3

Execl Throughput                               188.3     5169.7      274.5

File Copy 1024 bufsize 2000 maxblocks         2672.0    97765.0      365.9

File Copy 256 bufsize 500 maxblocks           1077.0    27526.0      255.6

File Read 4096 bufsize 8000 maxblocks        15382.0   657348.0      427.3

Pipe-based Context Switching                 15448.6   252913.1      163.7

Pipe Throughput                             111814.6  1373811.4      122.9

Process Creation                               569.3    14007.6      246.0

Shell Scripts (8 concurrent)                    44.8      865.7      193.2

System Call Overhead                        114433.5  1572901.6      137.5

=========

FINAL SCORE                                                     195.5

6.macbook pro/2G/Core 2 Duo 2.26G

INDEX VALUES

TEST                                        BASELINE     RESULT      INDEX

Dhrystone 2 using register variables        376783.7  9436477.8      250.4

Double-Precision Whetstone                      83.1     1904.4      229.2

Execl Throughput                               188.3     1155.1       61.3

File Copy 1024 bufsize 2000 maxblocks         2672.0    83321.0      311.8

File Copy 256 bufsize 500 maxblocks           1077.0    22021.0      204.5

File Read 4096 bufsize 8000 maxblocks        15382.0   465187.0      302.4

Pipe Throughput                             111814.6   692730.0       62.0

Pipe-based Context Switching                 15448.6   114287.7       74.0

Process Creation                               569.3     4800.8       84.3

Shell Scripts (8 concurrent)                    44.8      394.0       87.9

System Call Overhead                        114433.5   744941.5       65.1

=========

FINAL SCORE                                                     127.9