Archive for February 21st, 2010

Update-29

1. Again, Back to Normal -> abnormal

2. 不管normal还是abnormal,牙痛还是牙肿,life还是要goes on,update还要不断,虽然精彩常断……

3. 春节回家亚克西,除夕春晚亚克西,holiday week亚克西,全靠党的政策亚克西;什么亚克西,什么亚克西啊,党中央的政策亚克西

4. 手机号码换了,这里也不怕再啰嗦一遍的…… 至于获得详情的方法这里不再啰嗦,不是什么都可以啰嗦的,看官需要培养好眼力,鄙人则需要锻炼好听力…… 经验和实践同时表明,换号码的成本不小,以后3G慢慢普及,移动TD众望所归杯具了之后,应该已经可以携号转网了吧,我可不想再折腾了……

5. crasher, which means uninvited guest, you don’t like it, i don’t like it, but if some day somehow i happens to be that beastly person, i wish it only resides in computer security category.

6. I like bread because bread TALK but people usually don’t.

ruby’s “python -m SimpleHTTPServer”

If I remembered right, the command below used to be the most voted one on commandlinefu.com:

$ python -m SimpleHTTPServer

the “SimpleHTTPServer” module is written in python and it maybe called “the python way”, but that’s not our topic today. what we really want to do here is just making a ruby equivalent for this popular command, using rack.

first, make sure you have rack gem installed on your system (if you’ve installed rails 2.x before, you may already have it):

$ sudo gem install rack

confirm installation (Rack 1.0 should also work for our example):

$ rackup --version
Rack 1.1

alright, preparation is done, let’s start cooking. only a rackup file will be sufficient, for consistency, let’s just call it simple_http_server.ru .

#!/usr/bin/env rackup
#\ -E deployment

use Rack::ContentLength

app = Rack::Directory.new Dir.pwd
run app

Continue reading →