Skip to content

Instantly share code, notes, and snippets.

View huacnlee's full-sized avatar

Jason Lee huacnlee

View GitHub Profile
@huacnlee
huacnlee / install-php.sh
Created March 8, 2011 03:13
Ubuntu 10.10 install PHP Apache2 from source
sudo apt-get install libjpeg8-dev libmysqlclient-dev
curl -O http://www.php.net/get/php-5.3.5.tar.gz/from/a/mirror
curl -O http://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.17.tar.gz
tar zxf httpd-2.2.17.tar.gz
cd httpd-2.2.17
./configure --prefix=/etc/apache2 --enable-so --enable-cgi --enable-info --enable-rewrite \
--enable-speling --enable-usertrack --enable-deflate --enable-ssl --enable-mime-magic \
--enable-dav --enable-vhost-alias --enable-proxy --enable-expires --enable-headers
make && sudo make install
@huacnlee
huacnlee / thread_pool.rb
Created November 15, 2010 08:36
Ruby 线程池类,用于控制同时最大允许多少个线程执行,并加入列队
require 'thread'
class ThreadPool
class Worker
def initialize
@mutex = Mutex.new
@thread = Thread.new do
while true
sleep 0.001
block = get_block
@huacnlee
huacnlee / Nginx 编译参数
Created August 28, 2010 18:09
Nginx 源代码编译参数
--with-http_ssl_module --with-http_realip_module --with-http_stub_status_module --with-http_gzip_static_module --with-file-aio
@huacnlee
huacnlee / gist:505669
Created August 3, 2010 01:22
CentOS 下面安装 PHP
# CentOS install php from souces
sudo yum install gcc-c++ httpd httpd-devel apr-devel libxml2-devel zlib zlib-devel mysql-devel openssl-devel
wget http://cn2.php.net/get/php-5.3.1.tar.gz/from/cn.php.net/mirror
tar -zxf php-5.3.1.tar.gz
cd php-5.3.1
./configure --with-configure-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-mysql --with-mysqli --with-zlib --enable-so --with-apxs2
sudo make && sudo make install
sudo cp php.ini-production /etc/php.ini
sudo vim /etc/php.ini
# 找到 include_path 设置为: include_path = "/usr/local/lib/php/"
@huacnlee
huacnlee / .vimrc
Last active September 5, 2015 14:34
Vim 配置文件 for Bash
"Vim 配置文件 for Bash
filetype indent on
syntax on
set paste
set sw=2
set ts=2
set history=100
set iskeyword+=_,$,@,%,#,-
set backspace=2
set autoindent
@huacnlee
huacnlee / gist:505642
Last active September 5, 2015 14:34
MySQL 常用命令
- MySQL 创建超级用户 创建用户,并有localhost下所有数据库的超级权限
mysql> grant all on *.* to monster@localhost identified by "123456";
mysql> flush privileges;
- 删除用户
mysql> use mysql;
mysql> delete from user where user = 'monster';
- 创建 Repl 的用户
@Sija
Sija / NSArray-Blocks.h
Created November 15, 2009 05:22
Making NSArray more ruby-ish
//
// NSArray-Blocks.h
// Handy codebits
//
// If you want to keep block definitions terse, simple and dynamic, have no
// problems with the incompatible block pointer types and you don't mind
// compiler warnings about sending a message without matching signature,
// DO NOT IMPORT THIS FILE, seriously.
//
// Created by Sijawusz Pur Rahnama on 15/11/09.