Create the config file under your .ssh folder.
Ex. /home/ykyuen/.ssh/config
Host remote1
HostName www.remote1.com
User ykyuen
Host remote2
HostName www.remote2.com
User kit
So instead of
ssh ykyuen@www.remote1.com
Just type
ssh remote1
Done =)
Reference: Matt Ryall – Configuring your favourite hosts in SSH
蘇格蘭明年公投,決定要不要獨立。首相金馬倫豪賭一手:公投通過,首相認輸,國家分裂;通不過,蘇格蘭獨立,不得再提。
這是文明的典範:雖然已經有成熟的議會民主,蘇格蘭獨不獨立,本來,民選的議會和首相,可以自行決定。但是,由於議會是「單議席單票制」,也就是說:一個選區,假設有一千選民,其中一個候選人,得到五百○一票,即順利代表一千人進議會,另一個候選人,雖得四百九十九票,那四百九十九人的意願,即刻等於零。
蘇格蘭人喊不公平:其餘那四百九十九人,如果都強烈主張獨立,我們在倫敦的下議院,為甚麼完全沒有聲音?
首相說:既然這樣,那就全蘇格蘭公投吧。你們贏了,就可以分裂出走。
Continue reading 陶傑 – 豪賭 →
全城不分左中右,一齊公審前亷政專員湯顯明。湯專員不服,反問香港的政黨和公眾?我犯了哪條法?不審湯專員,還不知道香港不分左中右,心裏原來那麼厭惡共產黨。因為罵湯專員的每一條罪行,罵的人心裏明白,其實都在罵中國。
一九七九年,當大陸剛開放,共黨官員開始收受厚禮:名貴香煙洋酒,還開始嫖娼。那時的官方評論,一致定調:這些幹部官員,都受了資本主義思想的腐蝕。
換言之,我們的共幹官員,學馬列出身,本質原來都純潔,只是受了外面資本主義社會的習氣污染,才學壞的。所以資本主義才是元凶。
今日全香港聲討湯專員,只因為小湯時時去大陸交流,中國國情,送禮、吃喝、遊山玩水,完全天經地義。回來香港,這一切通成罪行。小湯在英治時期,因受英國白人領導,品格端正;「回歸祖國」之後,淪為貪腐罪犯,請問,小湯受哪一國的污染,被哪個國家教壞,不是和尚頭上叮的蒼蠅——明擺着的,你罵湯顯明,不就是在罵中國?
Continue reading 陶傑 – 暗中在審誰 →
I found an elegant solution written by Ateş Göral about rounding number to a certain significant figures in Javascript .
Magnetiq – Rounding to a Certain Significant Figures in JavaScript
function sigFigs(n, sig) {
var mult = Math.pow(10, sig - Math.floor(Math.log(n) / Math.LN10) - 1);
return Math.round(n * mult) / mult;
}
alert(sigFigs(1234567, 3)); // Gives 1230000
alert(sigFigs(0.06805, 3)); // Gives 0.0681
alert(sigFigs(5, 3)); // Gives 5
Done =)
There is no git rm . to stage the deleted files in a Git repository. Here are some alternatives which could help you to achieve that.
1. Stage deleted files only.
git ls-files --deleted | xargs git rm
2. Stage the modified and deleted files.
git add -u
3. Stage all newly added , modified and deleted files.
git add -A
Done =)
Reference: StackOverflow – Removing multiple files from a Git repo that have already been deleted from disk
巴基斯坦女童馬拉拉的經歷,感動了文明世界。她出生在一個山谷,塔利班在她的家鄉奪權,厲行原教旨統治,嚴禁女童接受教育。馬拉拉堅決要讀書,乘巴士上學,遭到塔利班土匪鎗擊,頭部重傷。
馬拉拉輾轉投奔西方,今日定居英國伯明翰。馬拉拉的勇氣和意志,她代表了善良和公義,贏得文明世界的崇敬。
但是對於西方的左膠知識份子,如何定位,卻形成了難題。首先,禁止女性受教育,是伊斯蘭原教旨的文化習俗。遵守文化傳統,是馬拉拉愛國愛伊斯蘭的義務,本來「天經地義」。
但是馬拉拉勾結「外國勢力」,在巴基斯坦時,已經跟英國BBC電台做時事日誌,唱衰她的塔利班祖國。她今天完全投身「西方文化霸權」,尊崇英國,但她完全沒提到英國在巴基斯坦的殖民統治時的罪惡。對於「知識份子」,馬拉拉是個難題:馬拉拉是個「巴奸」,但也是女性,他們不知道,到底是「西方霸權」罪惡呢,還是塔利班殘酷涼血的「男性霸權」更混蛋。
Continue reading 陶傑 – 馬拉拉難題 →
如果梁班子是十八世紀末的波邦王朝——此一譬喻,純為方便,波邦王朝的法國,是古典主義精雅文化的豐盛期 ,今日的香特,當然不可類比——那麼香港的電視霸權,越來越像巴士的獄。
巴士的獄不是路易十六蓋的,但路易十六繼承了此一「品牌」。此外,攻打巴士的獄那天,發現裏面只有六名囚犯,但香港大氣電波的巴士的獄,卻是由雄厚的「慣性收視率」、亦即數以百萬計的遙控點擊建成的,所以法國的巴士的獄一日攻克,香港的那座卻不可能。
因為香港有「慣性收視率」,在法國大革命前夕,並無「慣性捱餓」、「慣性入獄」、「慣性為囚」。什麼叫「慣性」?根據巴夫洛夫對狗的實驗:搖一下手鈴,再讓狗吃一口,久而久之,狗的食慾與鈴聲掛上了號,以後狗只聽見鈴聲,就張嘴巴伸舌頭想吃,這就叫慣性。
很明顯,慣性對於狗,是生理規律,但人應該比狗高等,然而在慣性的意義之中,人不必聽鈴聲,就有了跟狗一樣的潛意慾,到底是人比狗更Sophisticated呢,還是人比狗更賤?如果尼采或者蘇格拉底復活,這是我最想請教的問題。
一個城市於電視有收視的慣性,所以電視台的霸權,與此一慣性有共生的關係。
同理,一個民族對奴役長期有順從的慣性,所以極權的壽命,亦與此一慣性地久天長。
Continue reading 陶傑 – 大氣巴士的獄 →
Yesterday i used a Puppet master as an example to talk about purging old files on Linux.
Of course we can setup a cron job and run the shell command daily for housekeeping. But as we are using Puppet , we don’t we do that thru Puppet manifest ?
tidy { 'puppet::reports':
path => '/var/lib/puppet/reports',
matches => '*.yaml',
age => '14d',
backup => false,
recurse => true,
rmdirs => false,
type => 'ctime',
}
The above tidy type will delete those .yaml which is older than 14 days.
Done =)
Reference: Google Groups – Purge puppet’s reports
One day i found that the Puppet master is running out of space and then i realize that there is a lot of run reports in YAML format located @ /var/lib/puppet/reports . I want to delete the old reports for releasing the disk space.
So i move to the /var/lib/puppet/reports directory and execute the following line to recursively remove any .yaml which is older than 14 days.
find $d -type f -name \*.yaml -mtime "+14" -exec rm -f {} \;
A few years ago i had a post about a housekeeping shell script which is quite similar to the above approach.
Done =)
Reference: Google Groups – Purge puppet’s reports
LibreOffice supports PDF conversion. What you need to do is to open the document in LibreOffice and click the Export as PDF… option under the file menu list. It’s good and simple to convert a single document but quite tedious if you have more files.
For batch conversion, we need to make use of the LibreOffice command in terminal .
1. Go to the directory which contains the source files.
2. Execute the following command to convert ALL files which ends with .odt into .pdf .
soffice --invisible --nologo --convert-to pdf *.odt
Continue reading LibreOffice – Batch convert files to PDF →
Posts navigation
Dream BIG and go for it =)