reinstall homebrew on osx

I kept getting various homebrew errors while doing brew update. Error: Failed while executing git pull origin refs/heads/master:refs/remotes/origin/master error: unable to unlink old ‘bin/brew’ (Permission denied) brew update fails ‘unable to unlink old ‘.gitignore’ I did a brew doctor, and got tons of warnings and errors. Um… let’s just do a clean re-install… I don’t have time to troubleshoot all that. If you want to do a clean install, here it is, assuming your brew –prefix is /usr/local. ...

August 8, 2014 · 1 min · birdchan

Installed Java 7 on Mac OS X but Terminal is still using version 6

If you need to upgrade your java version on osx, it may not be as simple as it seems. You can try many things people suggest on this post, but I found out that the easiest way is to simply install the JDK8. The download page is below, look for jdk-8u11-macosx-x64.dmg. http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html Then after installing, you will have the upgraded java version in the terminal. localhost username$ java -version java version "1.8.0_11" Java(TM) SE Runtime Environment (build 1.8.0_11-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)

August 1, 2014 · 1 min · birdchan

Appengine datastore local path

If you need to say delete your local datastore files, here is how to find the path on osx. find /private/var/folders/ -name datastore.db Then just look for your app_id and figure out where the path is. The datastore.db file turns out to be a sqlite3 file. Um… I suppose you can do your own sql operations from there…

July 28, 2014 · 1 min · birdchan

聰明是挽救不了道德的空白

十二年前,有一個小女孩剛畢業就去了法國,開始了半工半讀的留學生活。漸漸地,她發現當地的的公共交通系統的售票處是自助的,也就是你想到哪個地方,根據目的地自行買票,車站幾乎都是開放式的,不設檢票口,也沒有檢票員。 甚至連隨機性的抽查都非常少。她發現了這個管理上的漏洞,或者說以她的思維方式看來是漏洞。憑著自己的聰明勁,她精確地估算了這樣一個概率:逃票而被查到的比例大約僅為萬分之三。 她為自己的這個發現而沾沾自喜,從此之后,她便經常逃票上車。 她還找到了一個寬慰自己的理由:自己還是窮學生嘛,能省一點是一點。 四年過去了,名牌大學的金字招牌和優秀的學業成績讓她充滿信心,她開始頻頻地進入巴黎一些跨國公司的大門,躊躇滿志地推銷自己。 但這些公司都是先熱情有加,然而數日之後,卻又都是婉言相拒。一次次的失敗,使她憤怒。她認為一定是這些公司有種族歧視的傾向,排斥外國人。 最后一次,她沖進了某公司人力資源部經理的辦公室,要求經理對於不予錄用她給出一個合理的理由。 然而,結局卻是她始料不及的。下面的一段對話很令人玩味。 「女士,我們並不是歧視你,相反,我們很重視你。你一來求職的時候,我們對你的教育背景和學術水平都很感興趣,老實說,從工作能力上,你就是我們所要找的人。」 「那為什麼不收天下英才為貴公司所用? 」 「因為我們查了你的信用記錄,發現你有三次乘公車逃票被處罰的記錄。」 「我不否認這個。但為了這點小事,你們就放棄了一個多次在學報上發表過論文的人才?」 「小事?我們並不認為這是小事。我們注意到,第一次逃票是在你來我們國家後的第一個星期, 檢查人員相信了你的解釋,因為你說自己還不熟悉自助售票系統,只是給你補了票。但在這之後,你又兩次逃票。」 「那時剛好我口袋中沒有零錢。」 「不、不,女士。我不同意你這種解釋,你在懷疑我的智商。 我相信在被查獲前,你可能有數百次逃票的經歷。」 「那也罪不至死吧?幹嘛那麼認真?以後改還不行嗎?」 「不、不,女士。此事證明了兩點: 一、你不尊重規則。你擅於發現規則中的漏洞並惡意使用。 二、你不值得信任。而我們公司的許多工作是必須依靠信任進行的,因為如果你負責了某個地區的市場開發,公司將賦予你許多職權。為了節約成本,我們沒有辦法設置復雜的監督機構,正如我們的公共交通系統一樣。所以我們沒有辦法雇用你,可以確切地說,在這個國家甚至整個歐盟,你可能找不到雇用你的公司。」 直到此時,她才如夢方醒、懊悔難當。 然而,真正讓她產生一語驚心之感的,卻是對方最後提到的一句話:道德常常能彌補智慧的缺陷,然而,智慧卻永遠填補不了道德的空白。

July 25, 2014 · 1 min · birdchan

Building Happiness

http://fast.wistia.net/embed/iframe/ilni3qvsc1?playerColor=076db9&version=v1&videoHeight=304&videoWidth=780&videoFoam=true One of the ways is to get 7 hours of sleep. =) This is from I Will Teach You To Be Rich

July 22, 2014 · 1 min · birdchan

PHP functions in Python?

Coming from the PHP background, very often I wonder if there are equivalent function calls in Python. Say for example, how do you do file_get_contents in Python? I find myself doing a lot of these searches lately. Here is this website php2python that tells you just that, with code examples.

July 20, 2014 · 1 min · birdchan

不準按

ref link: http://mp.weixin.qq.com/s?__biz=MjM5MjA0MDMwMA==&mid=201142082&idx=2&sn=6fb9eaf7344c0798d93ccccbb2d657a3

July 18, 2014 · 1 min · birdchan

How to Setup Chromecast Outside of the U.S.

Just some notes to remind me of how to set up chromecast outside of the US. http://techneversleeps.com/how-to-setup-chromecast-outside-of-the-u-s/ Basically, download the chromecast apk file and run it on your android.

July 18, 2014 · 1 min · birdchan

Generating SSH Keys

This is a handy link to help set up SSH keys for working with github. https://help.github.com/articles/generating-ssh-keys Below are some of the commands: ls -al ~/.ssh ssh-keygen -t rsa -C "your_email@example.com" eval "$(ssh-agent -s)" ssh-add ~/.ssh/id_rsa pbcopy < ~/.ssh/id_rsa.pub After pbcopy, just head over to Github Account Settings to add your SSH key.

July 17, 2014 · 1 min · birdchan

Condo vs Townhouse

What is a condo? What is a townhouse? CondoTownhouseStructure A home that is part of a larger structure, similar to an apartment buildingA home that shares adjoining walls with a row of similar homesOwnership Resident only owns the interiorResident owns the interior plus the yard on which it is situatedLegal Status Governed by specific statutes varying per stateLaws like those applicable to single family homesInterior Typically one-level, may be on any floorStarts on ground-level, may be multi-storied ...

July 15, 2014 · 1 min · birdchan