Skip to content

Instantly share code, notes, and snippets.

View daqing's full-sized avatar

David Zhang daqing

View GitHub Profile
@daqing
daqing / nginx.conf
Created February 22, 2009 11:16
nginx config to run Aeolus
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
/*
* BBCode.js - javascript BBCode module by Zhang Qingcheng <[email protected]>
*
* usage:
*
* 1. load this module
* <script type="text/javascript" src="<?php echo get_domain_name_by_app('js', true);?>/c/BBCode.js"></script>
*
* 2. get an instance to use it
* <script type="text/javascript">
#include <stdio.h>
void countNewLine(char, int *);
int main(void)
{
int count = 0;
countNewLine(getchar(), &count);
#! /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 \
#! /bin/bash
sudo aptitude install -y \
subversion \
git-core \
vim-full \
ctags \
stardict \
glade \
xclip \
make \
#! /usr/bin/env python
"""
uncompress packages from ~/software/ directory
"""
import os, sys
p = os.path
cwd = os.getcwd()
#! /usr/bin/env python
# vim: set fileencoding=utf-8
"""
download softwares
"""
import os, sys
p = os.path
#! /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;
" 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>
#! /bin/bash
# compile python from source with debug support
./configure --prefix=/dev/null --with-pydebug
make -s -j2