zsh number pad not working

oh-my-zsh issue 2654

@tomduncalf’s answer

1
I found a fix for this issue over at the iTerm 2 issue tracker: https://code.google.com/p/iterm2/issues/detail?id=2000 - basically, go to Preferences -> Profile -> Keys and load the "xterm with numeric keypad" preset. Not sure why this isn't the default!

use zsh

4th/7/2015

To hide username@computername both in local and ssh login mode

Add following lines in .zshrc

1
2
3
prompt_context() {
# empty function to override agnoster.theme render username@computername function
}

Auto switch theme when ssh login

Change theme line in .zshrc to following lines

1
2
3
4
5
if [[ -n "$SSH_CLIENT" ]]; then
ZSH_THEME="ys"
else
ZSH_THEME="agnoster"
fi

Install font on iOS device

Update May 28, 2015

Using agnoster

  1. Install powerline/fonts

  2. Change iterm2 font to Ubuntu Mono Derivative Powerline reference

  3. Add DEFAULT_USER=zx in ~/.zshrc to hide username@localhost

  4. Make theme like screenshot
    image

    1
    $ wget https://raw.github.com/altercation/solarized/master/iterm2-colors-solarized/Solarized%20Dark.itermcolors

    iTerm -> Profiles -> Colors ->
    Load Presets... -> Import... -> Solarized Dark.itermcolors


Install oh-my-zsh by running follow command

1
2
3
4
5
# via curl
$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
# via wget
$ sh -c "$(wget https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)"

Download iTerm2

Instead I went to iTerm2 -> Preferences -> Profiles -> Default and in the General Tab set the Command to /bin/zsh instead of Login shell

显示中文

1
2
3
4
5
6
cd ~
vi .zshrc
/en_US
#remove the #
:wq
source .zshrc

install autojump

1
2
3
4
5
6
7
8
9
git clone git://github.com/joelthelion/autojump.git
cd autojump
./install.py
vi ~/.zshrc
#paste
[[ -s /Users/[ME]]/.autojump/etc/profile.d/autojump.sh ]] && source /Users/[ME]/.autojump/etc/profile.d/autojump.sh
# to the last of .zshrc
#Please restart terminal(s) before running autojump.

tfs via git

Mac下配置Git-TF来连接TFS2012

Adding a certificate authority to the Java runtime

Git For TFVC Users

  1. Download latest release of git tf
  2. Extract the contents of git-tf-2.0.3.20131219.zip to a folder on your local machine, i.e. /Users/[ME]/git-tf/ on mac.
  3. Add the path where you extracted Git-TF (i.e. /Users/[ME]/git-tf/) to your PATH environment variable.

open ~/.profile

1
2
3
4
5
export PATH="/Applications/Xcode.app/Contents/Developer/usr/libexec/git-core/":$PATH
export PATH="/Users/[ME]/git-tf/":$PATH
export JAVA_HOME="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home"
$ source .profile
  1. add user name and password
1
2
git config --global git-tf.server.username username
git config --global git-tf.server.password ***********
  1. install ca.cer

required java version “1.6.0_65” (must)

download Java for OS X 2014-001

1
2
3
4
5
sudo keytool -import -trustcacerts -file zztxca.cer -alias CompanyCA -keystore /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/cacerts
#the default password for the cacerts keystore is `changeit`
#When asked Trust this certificate? by keytool, answer yes
  1. clone project
1
git tf clone https://server.com/tfs $/projectName
  1. pull
1
2
3
4
5
git tf pull
```
8. checkin

git tf configure http://myserver:8080/tfs/mycollection $/TeamProjectA/Main
git tf pull
git commit -a -m “merge commit”
git tf checkin
git push

1
2
9. recommended git settings

git config [–global] core.autocrlf false
git config [–global] core.ignorecase true
```

cocoapods update error

Run pod install

Get message like below

1
2
3
4
5
6
7
8
9
10
11
12
13
14
[!] From now on use `abc.xcworkspace`.
[!] The use of implicit sources has been deprecated. To continue using all of the sources currently on your machine, add the following to the top of your Podfile:
source 'https://github.com/CocoaPods/Specs.git'
[!] The `abc [Debug]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.debug.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.
[!] The `abc [Release]` target overrides the `OTHER_LDFLAGS` build setting defined in `Pods/Target Support Files/Pods/Pods.release.xcconfig'. This can lead to problems with the CocoaPods installation
- Use the `$(inherited)` flag, or
- Remove the build settings from the target.

Build project get error below

1
2
3
Undefined symbol for architecture “_OBJC_CLASS_$_AFHTTPClient”
blablabla

#Solution :

Add $(inherited) to Ohter Linker Flags

xcode download addresses

How to download Xcode 4 / 5 / 6 and get the DMG file?

https://developer.apple.com/downloads/

git note 2

How To Set Up Automatic Deployment with Git with a VPS

1
2
cd project.git/hook
vim post-receive

Add the following lines into post-receive

1
2
#!/bin/sh
git --work-tree=/path/of/project --git-dir=/path/of/project.git checkout -f

Then make post-receive executable

1
chmod +x post-receive

Create a Zip archive that contains the contents of the latest commit on the current branch.

1
git archive -o latest.zip HEAD

How many lines of code differs between two commits?

1
git diff --shortstat commit1 commit2

git merge tool

1
2
3
4
5
6
7
8
9
10
11
#configure
git config [--global] merge.tool <toolname> #vimdiff opendiff meld or kdiff3
git config --global mergetool.keepBackup false
#using kdiff3
git config --global merge.tool kdiff3
git config --global mergetool.kdiff3.path /Applications/kdiff3.app/Contents/MacOS/kdiff3
#remove .orig backup file [Git mergetool generates unwanted .orig files](http://stackoverflow.com/a/26218700/2480488)
#merge using specific tool
git mergetool -t <toolname>

resolve merge conflicts

1
2
3
4
5
6
grep -lr '<<<<<<<' . #output conflict files
git checkout --ours PATH/FILE #solution is current branch
git checkout --theirs PATH/FILE #solution is others branch
grep -lr '<<<<<<<' . | xargs git checkout --ours
grep -lr '<<<<<<<' . | xargs git checkout --theirs

fetch from origin with deleted remote branches

1
git fetch -p

revert git commit on server
Undoing a git push

git reset --hard <commit>
git push -f origin <commit>:<branch>
#reset local and origin <branch> to <commit>

reduce git repository size

git reflog expire --all --expire=now
git gc --prune=now --aggressive

git total count

git rev-list HEAD --count

git rebase

git rebase --onto <newbase> <since> <till>

 git rebase -i <newbase>    

git help config

git help config

git checkout

git checkout 

git reset

git reset --soft <commit>    # 不修改工作区和暂存区,只重置master
git reset --hard <commit>    # 替换工作区,暂存区,master <commit>
git reset --mixed 

git reset

git add .
git reset HEAD .    # 撤销 git add .

git reset <commit> <paths> # 重置暂存区为<commit>

git reflog

git reflog             #查看之前几次修改 SHA1值
git reset --hard HEAD@{num} 

commit count

git rev-list HEAD --count

git clean

git clean -f -d 

git stash

# 保存当前工作状态
git add .                     # 加入index
git stash                     # 保存 ,当前工作区所有

git stash list                 # 查看 stash list
git checkout -b new_branch

# do some thing ...

git checkout master
git stash pop               # 多个stash 使用git stash pop stash@{num}

后悔药

git checkout HEAD^ -- <file path>

HEAD^         后悔一步
HEAD^^         后悔两步
HEAD^^^     ...
HEAD^4        ...
HEAD^5        以此类推

角色: 最近六次提交分别是ABCDEF

$git log --online -6
XXXXXXX modify hello.h                        # F    XXXXXXX add hello.h                            # E
XXXXXXX ignore object files                    # D
XXXXXXX move .file outside also works.        # C
XXXXXXX Hello world initialized                # B
XXXXXXX README is frome welcome.txt        # A

坏蛋: 提交 D。

目的就是:干掉提交D
需要拣选指令–git cherry-pick
含义是从众多的提交中挑选出一个提交应用在当前的工作分支中。该命令需要提供一个提交ID作为参数,操作过程相当于讲该提交到出为补丁文件,然后在当前HEAD上重放,形成无论内容还是提交说明都一致的提提交
首先对版本库要‘参演’的角色进行标记,使用git tag 命令

git tag F
git tag E HEAD^
git tag D HEAD^^
git tag C HEAD^^^
git tag B HEAD^4
git tag A HEAD^5

1.第一幕干掉坏蛋 D
(1) 执行 git checkout ,暂时将 HEAD 头指针切换到 C。
切换过程显示非跟踪状态的警告,没有关系,因为剧情需要。

$git checkout C
$git checkout -b new_branch_name

(2) 执行拣选操作将 E 提交在

change some history comment

git rebase -i <commit number>

change last comment

git commit --amend    

安装自动补全命令

brew install bash-completion

.gitignore

# 这是注释行 -- 被忽略
*.a         # 忽略所有以 .a 为扩展名的文件。
!lib.a        # 但是 lib.a 文件或者目录不要忽略,即使前面设置了对 *.a 的忽略。
/TODO         # 只忽略此目录下的 TODO 文件,子目录的 TODO 文件不忽略。
build/      # 忽略所有 build/ 目录下的文件
doc/*.txt     # 忽略文件如 doc/notes.txt,但是文件如 doc/server/arch.txt 不被忽略。

“# a comment - this is ignored
# no .a files
*.a
# but do track lib.a, even though you're ignoring .a files above
!lib.a
# only ignore the root TODO file, not subdir/TODO
/TODO
# ignore all files in the build/ directory
build/
# ignore doc/notes.txt, but not doc/server/arch.txt
doc/*.txt
# ignore all .txt files in the doc/ directory
doc/**/*.txt”

remove ignored files

1
2
3
git rm -r --cached .
git add .
git commit -am "Remove ignored files"

git rev-list HEAD | wc -l

git rev-list HEAD | wc -l   # 查看历史提交次数

git diff

git diff B A             # 比较里程碑 B 和里程碑 A
git diff A                # 比较工作区和里程碑 A
git diff --cached A     # 比较暂存区和里程碑 A
git diff --cached        # 比较工作区和暂存区
git diff HEAD             # 比较工作区和HEAD

若只有一个参数就是比较工作区和 这个参数
两个参数就是比较两个参数
参数可以是 里程碑 commitId 工作区 等等

git diff <commit1> <commit2> -- <paths>

git blame

git blame <file path>     # 文件追溯