A gotcha with command order in pipes

Here's a mistake I've made more than once:

tail -f active-log | grep big-filter | grep -v one-thing

(Here the big-filter is something that selects only a small amountof actual interesting logfile output, and then you want to throw awaya small bit more. For example, my most recent version of this wasmonitoring the exim log on our new mail system for failures and otheranomalies, and then wanting to throw away one particular known failure.)


風花雪月

風花雪月


「蘭開夏道」這個專欄,很多人看得咬牙切齒。是的,我曾經毫不留情地批評「北方佳麗」,並因此而開罪了至少五十萬個香港男人,背上「傷害中國人民感情」的罪名;在「以貌取人」等文裡,港男同樣被我嘲諷得好

How to properly look up hostnames from IP addresses

Looking up reverse DNS to determine the hostname of an IP address thatyou are talking to is one of those almost simple things that softwarekeeps getting wrong .So here is how you do it, in two variants.

First, if you use DNS and have an (almost) empty /etc/hosts or justdon't care about looking up something in it, is the simple version:

  • gethostbyaddr() the IP address. If it fails, you are done. Otherwiseyou have the claimed hostname .

    (


上港台,和「自己人」開咪。

較早前在本blog寫了一篇有關Levi’s 廣告攣與直的網誌,港台的Eric看後,便找了我上了他和梁兆輝主持的節目「自己人」做嘉賓,講一下gay marketing這題目。

噢,想來我真的和港台有緣,今次已經是第二次被不同的DJ邀請,看來DJ們都經


A silly trick with X

Once upon a time, I was at home and really needed to see somethingthat was displayed on my screen at work. This being Unix, there was noconvenient remote desktop add-on that would have let me mirror my workdisplay to home, but this being Unix, there are ways around that.

(Also, I was connecting over a slow dialup PPP connection , so a live remote desktop thing would havebeen difficult anyways.)

My first attempt was simple; ssh in to the work machine and do


近來,一直在為錢發愁。

下個月就要27歲的我,所有的銀行存款加起來,都不夠買一部手提電腦。

下個月就要27歲的我,朋友請我去吃魚翅,我卻窮得連上班用的淺色胸罩都捨不得買。

不要告訴我經濟大好市面一片欣欣向榮

無題

下個月,就27歲了。

I have new system enthusiasm

I get it every so often: a new system that consumes my attention, mythoughts, and my interest. I find myself thinking about it all the timeand then working on it all the time; it doesn't matter that I'm not atwork, I want to work on it anyways so I do. And I'm impatient to seewhat I've built go into production, to actually get used, to give me feedback .

The current new system enthusiasm is for our new mail


Run, Fatboy, Run


今日去做了一回罕見的事
是一項體能測試
跑400
事前我自己預測會刷新一項全澳最慢紀錄
甚至有可能跑不完全程
不過真正要跑的時候就沒有想像中辛苦
雖然已經很久沒有跑步了
今日還是用了1分46完成400米
我知道比起許

An improvement in my comment spam precautions

A while back, I thought that a comment spammer had broken my simplescheme to prevent people from fetching the 'addcomments' page once and then using their zombie farm to submit spam, soI decided to switch to a more secure system for this. Since the weaknessin my scheme was spammers being able to replace my hidden informationabout the IP address that originally fetched the 'add comments' pagewith their own, the obvious fix was to sign the IP address using HMAC .

(It turned out that the