2007年9月22日星期六

学习笔记:VIM-1 基本操作

查看配置文件列表
:scriptnames
删除两行间的换行符
J
重做
CTRL-R
撤销
u
行撤销
U
括号匹配
%
移动到指定行
nG(G会把光标移到文件末)

设置行号
:set number
关闭行号
:set nonumber

查看配置文件列表
:scriptnames
删除两行间的换行符
J
重做
CTRL-R
撤销
u
行撤销
U
括号匹配
%
移动到指定行
nG(G会把光标移到文件末)

设置行号
:set number
关闭行号
:set nonumber
滚屏
CTRL-U CTRL-D
CTRL-F CTRL-B
查找
/正向 ?反向
n/N 下一个/上一个
忽略大小写
:set ignorecase
\> 表示单词末尾/\<单词开头 比如/\<the\> 将会查找单词 the

高亮显示匹配
:set hlsearch

可视模式
字符选择
v 例如vll
行选择
V 例如Vjj

拷贝
y 复制
p 粘贴

2007年9月21日星期五

安装subversion

apt-get update
安装apache2
apt-get install apache2
安装subversion
apt-get install libapache2-svn subversion
创建目录
mkdir /home/svn
创建项目
svnadmin create /home/svn/foo
由于要用apache2来提供服务, 更改目录权限
chown www-data.www-data /home/svn/foo -R
配置apache2
/etc/apache2/mods-available/dav_svn.conf
//表示svn仓库位于/svn虚拟目录下面,意思是版本库的URL是http://MyServer/svn/
DAV svn //表示dav启用svn支持
SVNParentPath /home/svn //表示使用SVNParent方式,并且仓库的物理路径为/home/svn

AuthType Basic //激活基本认证,就是用户名/密码

AuthName "Subversion Repository" //用来说明何时弹出要求用户输入认证信息的认证对话框
AuthUserFile /etc/apache2/dav_svn.passwd //表示用户认证文件是/etc/apache2/dav_svn.passwd

AuthzSVNAccessFile /etc/apache2/dav_svn.authz ////表示用户权限文件是 /etc/apache2/dav_svn.authz

#
Require valid-user //指定只有输入了正确的用户/密码的用户可以访问URL
#




如果你希望所有人可以读你的版本库,但是只有特定用户可以写,你可以修改下面几行

Require valid-user

to


Require valid-user



配置访问权限
/etc/apache2/dav_svn.authz(/etc/apache2/mods-available/dav_svn.conf指定的)
[foo:/]
* =
tony = rw

然后在添加用户到 /etc/apache2/dav_svn.passwd

htpasswd -c /etc/apache2/dav_svn.passwd tony

访问测试
http://localhost:81/svn/foo
现在因为我们还没有往svn是添加任何东西,所以我们看到的是"Revision 0: /"



Options Indexes FollowSymLinks MultiViews
AllowOverride None

Order allow,deny
allow from all

http://man.chinaunix.net/linux/debian/debian_learning/ch09s14.html
http://mattl.co.uk/apache2subversiondebianhowto.html
http://www.howtoforge.com/apache_subversion_repository_p2
http://www.howtoforge.com/debian_subversion_websvn


生成私钥
openssl genrsa 1024 > gzjs.gov.cn.key

生成证书签署申请CSR
openssl req -new -key gzjs.gov.cn.key > gzjs.gov.cn.csr

用自己的私钥签署申请,生成证书
openssl req -x509 -key gzjs.gov.cn.key -in gzjs.gov.cn.csr > gzjs.gov.cn.crt

添加以下内容到站点配置文件
SSLEngine On
SSLCertificateFile /etc/apache2/ssl/gzjs.gov.cn.crt
SSLCertificateKeyFile /etc/apache2/ssl/gzjs.gov.cn.key

添加一下内容
SSLRequireSSL
到/etc/apache2/mods-available/dav_svn.conf文件
重启


http://wiki.debian.org.hk/w/Generate_SSL_cert

2007年9月19日星期三

ab 压力测试

20490 tomcat55 18 0 303m 90m 5900 S 109 4.5 1:27.28 jsvc

# ab -c 1000 -n 100000 http://127.0.0.1:8080/gzjsgov/index.html
This is ApacheBench, Version 2.0.40-dev <$Revision: 1.146 $> apache-2.0
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Copyright 2006 The Apache Software Foundation, http://www.apache.org/

Benchmarking 127.0.0.1 (be patient)
Completed 10000 requests
Completed 20000 requests
Completed 30000 requests
Completed 40000 requests
Completed 50000 requests
Completed 60000 requests
Completed 70000 requests
Completed 80000 requests
Completed 90000 requests
Finished 100000 requests


Server Software: Apache-Coyote/1.1
Server Hostname: 127.0.0.1
Server Port: 8080

Document Path: /gzjsgov/index.html
Document Length: 7760 bytes

Concurrency Level: 1000
Time taken for tests: 49.334775 seconds
Complete requests: 100000
Failed requests: 12
(Connect: 0, Length: 11, Exceptions: 1)
Write errors: 0
Total transferred: 799601930 bytes
HTML transferred: 777070880 bytes
Requests per second: 2026.97 [#/sec] (mean)
Time per request: 493.348 [ms] (mean)
Time per request: 0.493 [ms] (mean, across all concurrent requests)
Transfer rate: 15827.80 [Kbytes/sec] received

Connection Times (ms)
min mean[+/-sd] median max
Connect: 1 376 1235.8 42 21067
Processing: 12 97 331.6 55 7291
Waiting: 0 84 326.1 47 7257
Total: 30 473 1352.8 109 21153

Percentage of the requests served within a certain time (ms)
50% 109
66% 133
75% 148
80% 160
90% 223
95% 3129
98% 3768
99% 9044
100% 21153 (longest request)

2007年9月17日星期一

学英语,有捷径

18岁的捷克司机Matej开车撞了,45分钟后醒来,他用流利的完整的无口音的英式英语和护士们交谈

未撞之前啊,小伙子才刚开始学英语

医生们从技术上这样解释:车祸使他脑内某些组织重组了

不幸的是,2天后,小伙子的技能就消失了,而且对那场车祸毫无记忆

然后,他又高高兴兴地去学英语了

Diggers:
D-1:有一次我不小心摔了Vista的本本,重启后就变Ubuntu了
D-2:这是说明英语能力与脑损伤有联系的第一手临床证据
D-3:对啊对啊,上次一个美国人拿自己头吹气,结果成英国佬的口音了。这不完全说明英国人都与精神错乱有点关系
D-4:Oh,快撞我一下吧,我明天要考西班牙语

2007年9月16日星期日

公开代理服务器

http://www.publicproxyservers.com/page1.html

收藏之