Skip to content

Instantly share code, notes, and snippets.

View joujiahe's full-sized avatar

Johnson Chou joujiahe

View GitHub Profile
@joujiahe
joujiahe / find-content.sh
Created August 6, 2012 01:56
Tips for useful Linux commands.
find -name "*.mk" -print | xargs grep "LOCAL_MODULE"
@joujiahe
joujiahe / PhoneWindowManager.java
Created August 22, 2012 07:41
Android system ui definitions.
// SystemUI (status bar) layout policy
int shortSizeDp = shortSize
* DisplayMetrics.DENSITY_DEFAULT
/ DisplayMetrics.DENSITY_DEVICE;
if (shortSizeDp < 600) {
// 0-599dp: "phone" UI with a separate status & navigation bar
mHasSystemNavBar = false;
mNavigationBarCanMove = true;
} else if (shortSizeDp < 720) {
@joujiahe
joujiahe / gmail-smtp.py
Created August 30, 2012 04:35
Using python SMTP through gmail to send mail with multiple receiver.
#!/usr/bin/python
import sys
import smtplib
subject = sys.argv[1]
body = sys.argv[2]
recipients = sys.argv[3]
gmail_user = 'username@gmail.com'
gmail_pwd = 'password'
@joujiahe
joujiahe / make-arm.sh
Created September 4, 2012 07:15
Make arm device.
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm xxxx_config
make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm
@joujiahe
joujiahe / shell-type.sh
Created September 4, 2012 07:18
Show the current shell type.
which sh | xargs ls -l
@joujiahe
joujiahe / gitolite-project.sh
Created September 28, 2012 07:58
Get gitolite project's name in post-receive hook.
#...
path=`pwd`
project_name=${path/"$HOME/repositories/"/""}
#...
@joujiahe
joujiahe / bootstrap.css
Created November 6, 2012 16:56
Bootstrap relative fix.
// For block below content issue.
body {
padding-top: 60px;
}
@media (max-width: 979px) {
body {
padding-top: 0px;
}
}
@joujiahe
joujiahe / git-autocompletion-for-mac.sh
Created April 9, 2013 08:58
Git auto-completion for mac computer.
curl https://raw.github.com/git/git/master/contrib/completion/git-completion.bash -o ~/.git-completion.bash
echo "source ~/.git-completion.bash" >> ~/.bash_profile
@joujiahe
joujiahe / top_10_shell_commands.sh
Created June 27, 2013 13:41 — forked from hanksudo/top_10_shell_commands.sh
Show your top 10 shell commands
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
@joujiahe
joujiahe / git-tree.sh
Created December 26, 2013 01:51
Show git tree in command line
git config --global alias.tree "log --graph --decorate --pretty=oneline --abbrev-commit"