Skip to content

Instantly share code, notes, and snippets.

View daqing's full-sized avatar

David Zhang daqing

View GitHub Profile
#! /bin/bash
find "$4" -depth -name "$3" -exec grep -Hni "$2" {} \;
#! /bin/bash
#
# File: check_status.sh
# Author: Kinch Zhang <kinch.zhang@gmail.com> with help from ChaoQian Xu <chaoranxu@gmail.com>
# Usage: $ check_status.sh [HOSTS ...]
#
function check()
{
ip=`ping $1 | head -n 1| awk '{print $3}'`
#! /bin/bash
# recursively searching current directory for "foo" in PHP files and replace it with "bar"
for i in `find . -depth -name "*.php" -exec grep -Hni "foo" | awk -F: '{print $1}'`; do
if [ -f "$i" ]; then
sed -i ".old" -e "s/foo/bar/g' "$i"
fi
done;
#! /usr/bin/env python
"""
uncompress packages from ~/software/ directory
"""
import os, sys
p = os.path
cwd = os.getcwd()
#! /bin/bash
# git init configs for Kinch Zhang
# username and email address
git config --global user.name "Kinch Zhang"
git config --global user.email kinch.zhang@gmail.com
# SVN-like shortcuts
git config --global alias.st status
#! /bin/bash
# compile python from source with debug support
./configure --prefix=/dev/null --with-pydebug
make -s -j2
" clever tab completion
function! CleverTab()
if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$'
return "\<Tab>"
else
return "\<C-N>"
endfunction
inoremap <Tab> <C-R>=CleverTab()<CR>
#! /usr/bin/env python
# vim: set fileencoding=utf-8
"""
download softwares
"""
import os, sys
p = os.path
#! /bin/bash
sudo aptitude install -y \
subversion \
git-core \
vim-full \
ctags \
stardict \
glade \
xclip \
make \
#! /bin/bash
# install nginx + php5(with apc & memcache extensions) + mysql
# install php5 first
echo "* installing PHP 5 with extension APC, Xdebug and Memcache..."
sudo aptitude install -y \
php5-cli \
php5-cgi \
php-apc \