2013年6月27日 星期四

2013年6月20日 星期四

[Quotes] Simple can be harder than complex ... Steve Jobs - 簡單比複雜難得多

"Simple can be harder than complex. You have to work hard to get your thinking clean to make it simple. But it’s worth it in the end because once you get there, you can move mountains." -- Steve Jobs

簡單比複雜難得多,你必須竭盡全力、理清思路,才能創造簡單。但這絕對值得,因為只有這樣,你才能開闢新世界。

2013年6月19日 星期三

[ssh] ProxyCommand - Run a local command before ssh to remote server.

Modify ~/.ssh/config
Host mydomain
    ProxyCommand sh -c "local_command /usr/bin/nc %h %p"

Host mydomain
    Hostname=mokoversity.com
    IdentityFile=~/.ssh/mokoversity_dsa
    User=hank
    PasswordAuthentication=no
    PubkeyAuthentication=yes

2013年6月18日 星期二

[Mac] ssh remote server through socks proxy - 經由socks proxy ssh到遠端Server

1. Install ProxyChains

$ wget https://gist.github.com/allenhuang/3792521/raw/bb52568695f9d745004eee87b892637f9d17a771/proxychains4_formula.rb
$ mv proxychains4_formula.rb /usr/local/Library/Formula/Proxychains.rb
$ brew install --HEAD proxychains

2. Modify ProxyChains conf

$ vim /usr/local/etc/proxychains.conf

set this line to conf:

socks4 127.0.0.1 8888

3. Open socks

ssh -vND 8888 user@socks.server

4. Settings Socks Proxy on Mac Network Preference

5. Connect to remote server

$ /usr/local/bin/proxychains4 ssh user@remote.server

2013年6月15日 星期六

[Vim] vim configuration

我其實很少用vim ... 不過有時候在Mac用一下、Linux用一下,覺得沒存一下設定檔不行... 所以慢慢整理一份出來

See Also

http://vim.wikia.com/wiki/Example_vimrc

2013年6月3日 星期一

F2E前端工程師面試問題集 - Front-end Job Interview Questions

Fork me on Github : Front-end-Developer-Interview-Questions

[OSX] dotfiles - zsh based Terminal editor and configuration files.

My dotfiles: https://github.com/hankwang/dotfiles

Image 1

Image 2

[OSX] copy last command by pbcopy - 複製上一個指令到剪貼簿

例如測試一行command是不是正確的, 確認之後我想複製起來做筆記或是貼到別地方, 這時候就可以透過pbcopy達到快速複製的效果, 不用再用滑鼠去框。

$ ps -awx

把上一個指令複製到剪貼簿

$ echo "!!" | pbcopy

把上一個指令的最後一個參數複製到剪貼簿

$ echo "!$" | pbcopy

2013年6月2日 星期日

[git] Syncing a fork - 同步原本repo的修改到fork出來的repo

  1. 加入新的遠端repo
  2. 取回遠端repo
  3. 合併repo到master
  4. 解決conflict的commits

列出目前的遠端repo

$ git remote -v 
origin https://github.com/user/repo.git (fetch)
origin https://github.com/user/repo.git (push)

加入一個新的遠端repo

$ git remote add upstream https://github.com/otheruser/repo.git

註: upstream 為加入的遠端repo名稱, 可以自取


查看新加入的遠端repo

$ git remote -v

origin https://github.com/user/repo.git (fetch)
origin https://github.com/user/repo.git (push)
upstream https://github.com/otheruser/repo.git (fetch)
upstream https://github.com/otheruser/repo.git (push)

取回新加入的遠端repo的所有分支(branches)

$ git fetch upstream

remote: Counting objects: 75, done.
remote: Compressing objects: 100% (53/53), done.
remote: Total 62 (delta 27), reused 44 (delta 9)
Unpacking objects: 100% (62/62), done.
From https://github.com/otheruser/repo
 * [new branch]      master     -> upstream/master

查看目前本機和遠端的所有分支(branches)

$ git branch -va

* master                  a422352 My local commit
  remotes/origin/HEAD     -> origin/master
  remotes/origin/master   a422352 My local commit
  remotes/upstream/master 5fdff0f Some upstream commit

合併upstream的master到目前repo的master

$ git merge upstream/master

Updating 34e91da..16c56ad
Fast-forward
README.md                 |    5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

如果merge時遇到conflict, 例如README.md conflict

$ git status

# You have unmerged paths.
#   (fix conflicts and run "git commit")
#
# Changes to be committed:
#
#   new file:   run.sh
#
# Unmerged paths:
#   (use "git add <file>..." to mark resolution)
#
#   both modified:      README.md

編輯README.md處理conflict的地方後, 重新commit

$ git add README.md
$ git rebase --continue

See also

Github - Syncing a fork

Related Posts Plugin for WordPress, Blogger...