This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user www-data; | |
worker_processes 1; | |
error_log /var/log/nginx/error.log; | |
pid /var/run/nginx.pid; | |
events { | |
worker_connections 1024; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 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"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
void countNewLine(char, int *); | |
int main(void) | |
{ | |
int count = 0; | |
countNewLine(getchar(), &count); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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 \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
sudo aptitude install -y \ | |
subversion \ | |
git-core \ | |
vim-full \ | |
ctags \ | |
stardict \ | |
glade \ | |
xclip \ | |
make \ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
""" | |
uncompress packages from ~/software/ directory | |
""" | |
import os, sys | |
p = os.path | |
cwd = os.getcwd() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# vim: set fileencoding=utf-8 | |
""" | |
download softwares | |
""" | |
import os, sys | |
p = os.path |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" 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> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
# compile python from source with debug support | |
./configure --prefix=/dev/null --with-pydebug | |
make -s -j2 |