oh-my-zsh

oh-my-zsh is a community-driven framework for managing zsh configuration.

ref:
https://github.com/robbyrussell/oh-my-zsh

Installation

$ curl -L https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
$ brew install zsh-completions

Plugins

ref:
https://github.com/vinta/dotfiles/blob/master/zshrc
https://github.com/robbyrussell/oh-my-zsh/tree/master/plugins
https://github.com/robbyrussell/oh-my-zsh/wiki/Plugins-Overview

$ alias
$ tab
$ ..
$ ~

j, z, fasd

這幾個指令都需要你曾經 cd 到該目錄作為歷史紀錄之後才能用
檔案的話需要被 vim 或 sublime 過

$ cd ~/Project
$ j pro
$ o pro

$ sublime /private/etc/hosts
$ sublime ~/.ssh/config
$ v hosts
$ v ssh config

jump

$ cd ~/Projects/streetvoice
$ mark sv
$ jump sv
$ unmark sv
$ marks

Themes

ref:
https://github.com/robbyrussell/oh-my-zsh/wiki/Themes

Use Docker Machine to setup Docker environments

Docker Machine is a command-line tool to help you create Docker environments on your computers or cloud providers.

ref:
https://docs.docker.com/machine/

Installatino on Mac

$ curl -L https://github.com/docker/machine/releases/download/v0.3.0/docker-machine_darwin-amd64 > /usr/local/bin/docker-machine
$ chmod +x /usr/local/bin/docker-machine

Usage

$ docker-machine ls

$ docker-machine create --driver virtualbox dev

# list arguments for creating a VirtualBox VM
$ docker-machine create -d virtualbox

# see how to connect Docker to this machine
$ docker-machine env dev

# run this command to configure your shell
$ eval "$(docker-machine env dev)"

# then
$ docker info

Issues

Error response from daemon: client and server don't have same version (client : 1.19, server: 1.18)

$ docker-machine upgrade dev

Install Go (Golang)

Installation

Ubuntu

$ sudo apt-get install -V golang
# or
$ wget https://storage.googleapis.com/golang/go1.4.2.linux-amd64.tar.gz
$ tar -C /usr/local -xzf go1.4.2.linux-amd64.tar.gz
# then add `export PATH=$PATH:/usr/local/go/bin` to your `/etc/profile`

$ which go

Mac OS X

$ brew install mercurial
$ bash < <(curl -s -S -L https://raw.githubusercontent.com/moovweb/gvm/master/binscripts/gvm-installer)
# then add `source /Users/vinta/.gvm/scripts/gvm` to your `.bash_prfile` or `.zshrc`

$ gvm listall
$ gvm install go1.4.2
$ gvm list
$ gvm use go1.4.2 --default

$ go env

ref:
https://github.com/moovweb/gvm

Environment Variables

GOROOT
就是你的 go 的安裝目錄(即是 bin/go 所在的路徑)
例如 /Users/vinta/.gvm/gos/go1.4.2

GOPATH
就是你的 workspace
例如 /Users/vinta/.gvm/pkgsets/go1.4.2/global
這個路徑你可以隨意指定()
go get 會把原始碼放到 $GOPATH/src
執行檔放到 $GOPATH/bin
lib (.a) 放到 $GOPATH/pkg

ref:
http://golang.org/doc/code.html