Unix utilities #4: Kill process by name

I need to kill some specific jobs by the process name (e.g. qqweibo) regularly and an ex-coworker of mine suggested this:

kill `ps faux | grep qqweibo | cut -d" " -f6-7`

This method is not robust. The problem arises from the cut command, it cannot extract the PID from the “ps faux” in some cases e.g. when the PID is less than <1000, it will slip through. A more robust way is to

kill `ps -ef | grep qqweibo | grep -v grep | awk ‘{print $2}’`

This method is slower (awk is slower than cut) but I don’t mind that <0.5s of delay.

On speaking English

My proficiency in written Chinese and oral Cantonese is not perfect, but at least I have published two novels in Chinese. I dream in Chinese and if my brain have a native language then that will also be Chinese.
I have to admit that my proficiency in English is not as good. It may not be a problem in 80% of life. I talk with my wife, my mother even my boss in Cantonese. I can also buy myself something to eat in McDonalds without speaking a single English word.
The thing is getting more complicated after this September. It is because I am now a tutor in a so-called “International University” and I need to teach a cohort of would-be journalists Excel and Statistics, IN ENGLISH.
I know that my oral English is hardly intelligible. I can feel the pain that my students are suffering because of the difficult subject itself and my poor instruction.
I always admire my colleges. Their skin colors are yellow, some of them are white. They are mostly educated in foreign countries, with perfect non-Chinese accent English and good confident. Yeah, the classical elites. Not me, a classical dumbass with an asshole-like attitude.
I have a very poor English foundation and it is impossible to fix. I don’t care about the style of my English but I need my English to be clear and correct. I need to proof read my written English constantly for multiple times to make sure it is correct. (Yeah, I am still proof reading this blog post and there are still numerous grammatical errors) On Facebook, when I talk to someone in English, I can feel their pain too. Preposition is always wrong. I always confuse at/on/in/by before a place or time. I also tend to use or/and incorrectly. Not to mention the biggest problem: tense. I can write a blog post in broken English entirely on my style of broken English. But I am really shame about it so I think I should cut it short.
My language is my biggest hurdle to express myself. Speaking more broken English will just make my English more broken.

Emacs customization

Yeah, I know Emacs sucks. But I like it.

I like this GNU Emacs for Mac OS X more than Aquamacs. I hate the OSX-ized experience of Aquamacs and I dumped it this morning.
In order to make Emacs works for me, I have to (heavily) customize it. My ~/.emacs grew to 41 lines and still counting.
List of customizations:

  1. Latest version of org-mode from package.el
  2. org2blog
  3. xmlrpc.el
  4. Turn off truncation of long lines for org-mode
  5. Octave-mode instead of Matlab mode
  6. Python-mode instead of python.el
  7. ESS – Emacs Speaks Statistics
  8. Color-theme, my favorite theme is clarity
  9. Default font to Monaco 18
  10. No blinking cursor
  11. Paren-mode to 1
  12. Not strictly Emacs customization – remapping the useless Caps-lock key on my MacBook keyboard to Ctrl. So that I can C-x C-f without moving my fingers away from the home row.


  1. deft
  2. git-mode
  3. Practicing touch typing

查字典: [U]

英文差,常常要查字典。要查字的讀音。個人認為英文是一種好陰濕的語文。例如 Strong 一字, ng 發成 /ŋ/ 。 Strong 比較級是 Stronger 及 Strongest ,在比較級的情況卻會發出 /g/ 音。可是,同樣的規則用在 Sing 變成 Singer ,卻不成立。1
還有是讀音的 stress ,如 violent, violet, violin 。三個詞的首四個字母都一樣,卻只有 violin 的 stress 在第二個音節。
另一個常查的是查詞性。最常查的是 noun 是否 countable 。例如今日蘋果日報國際版頭條有此句:


“Truth and love must prevail over lies and hatreds.”

見到 “hatreds” 一字覺得非常礙眼。打入同一句在 Google 搜尋,原句似乎都沒有加 s 。由於不太肯定,於是去查 Cambridge 字典。的而且確,有 [U] 符號,代表此字是 uncountable ,故此是無需加 s 的。至於為何蘋果日報撰稿及編輯認為 hatred 要加 s ,難道是要和可數的 lie 對偶?

  1. 雖然我曾聽過有人將 Singer 讀成 /ˈsɪŋgə/ 。 Singer Sewing Machine 漢譯為勝家縫紉機,也有誤導成份。 []