среда, 11 сентября 2013 г.

ZSH: restoring last working directory

This little snippet helps to save/restore working directory on start/exit zsh shell:
autoload -Uz add-zsh-hook
function save_pwd {
echo "$PWD" > "$HOME/.zshpwd"
}
add-zsh-hook chpwd save_pwd
cd `cat $HOME/.zshpwd 2>/dev/null`
put it in ~/.zshrc :)

вторник, 10 сентября 2013 г.

Android build simplifier

Add this alias to ~/.bashrc:
alias amake='_(){ rm -f ./build.log; . ./build/envsetup.sh; lunch $1; make -j8 2>&1|tee ./build.log; }; _'
and now you can avoid envsetup.sh, lunch running and get build log file :) Better is to run:
$ amake something-userdebug
from Android source directory.
Or the same but as explicit function (put it, for example in ~/.zshrc):
function amake() {
/bin/bash -s stdin << EOF
rm -f ./build.log
. ./build/envsetup.sh
lunch $1
make -j8 2>&1|tee ./build.log
EOF
}