dos2unix 一般发行版都会带这个工具。
Vim 里面 替换 \r 为空。
月度归档: 2011 年 2 月
shanghai作为动词
http://zh.wikipedia.org/zh/Shanghai
shanghai意指以诱骗、恐吓、暴力手段招募船员,从事此行为者称为crimps(掮客)。1915年以前,美国船支不断发生此被迫劳役现象。相关词组press gang则与大英帝国海军强征入伍有关。
hack redmine 实现自定义未登录跳转
app/controllers/application_controller.rb
130 改为 :format.html { redirect_to ‘http://www.abc.com/’ }
通过SSH Tunnel连接远程数据库
原理很简单:利用SSH Tunnel做个映射。
ssh -L 3307:localhost:3306 one@dbserver
然后用 mysql 连接本地的 3307 端口即可。
参考文章:http://www.whoopis.com/howtos/mysql_ssh_howto.html
一个RewriteCond应用到多个RewriteRule
默认情况下 RewriteCond 只应用到 其紧跟着的 RewriteRule。
手册里有个 RewriteCond backreferences :
http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritecond
貌似可以实现一个RewriteCond应用到多个RewriteRule,不过看了一下不知道怎么用。
Ask Google大神找到了一个老外的解决方案:
http://my.galagzee.com/2009/02/11/mod_rewrite-one-rewritecond-to-many-rewriterules/
RewriteCond %{REQUEST_URI} !^/(pattern1|pattern2|pattern3)(/[0-9]+|/P[0-9]+|)[/]?$ [NC]
RewriteRule . – [S=3]
RewriteRule ^/([^/]*)[/]?$ /index.php/site_embeds/department/$1/X [L]
RewriteRule ^/([^/]*)/([0-9]+)[/]?$ /index.php/site_embeds/article/$2/$1 [L]
RewriteRule ^/([^/]*)/P([0-9]+)[/]?$ /index.php/site_embeds/department_archive/P$2/$1 [L]
RewriteRule 有个 S 参数,可以用来跳过其后续一定数量的规则。
然后对RewriteCond的条件取反,就可以实现了。