Skip to content

Instantly share code, notes, and snippets.

View huacnlee's full-sized avatar

Jason Lee huacnlee

View GitHub Profile
# Nginx Linux 下面创建为系统服务脚本
#!/bin/sh -e
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
@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/"
# Linux 遍历目录下面所有文件,将文件名转为小写
#!/usr/bin/python
# the following script will traverse through all of the files
# within the directory where it is placed and replace each
# underscore within the filename with a space
import os, sys,re
print "Auto convert Upper filename to Lower filename"
dir = '/home/huacnlee/uploadfiles'
# php-fcgi Initialize script
#!/bin/bash
BIND=127.0.0.1:9000
USER=jason
PHP_FCGI_CHILDREN=15
PHP_FCGI_MAX_REQUESTS=1000
PHP_CGI=/usr/bin/php-cgi
PHP_CGI_NAME=`basename $PHP_CGI`
PHP_CGI_ARGS="- USER=$USER PATH=/usr/bin PHP_FCGI_CHILDREN=$PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=$PHP_FCGI_MAX_REQUESTS $PHP_CGI -b $BIND"
# Python said, Ruby is Best
Python 2.6.4rc2 (r264rc2:75497, Oct 20 2009, 02:55:11)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> "Ruby" > "Python"
True
>>> "Ruby" > ".NET"
True
>>> "Ruby" > "Java"
# SVN 服务器创建简单步骤
$ mkdir svn
$ cd svn
$ svnadmin create simple
$ sudo svnserve -d -r ~/svn/
$ cd ~
$ svn co svn://127.0.0.1/simple
/*
project: http://github.com/livid/v2ex
file: http://github.com/livid/v2ex/blob/master/static/css/desktop/style.css
*/
#Navigation {
float: right;
text-align: right;
font-size: 14px;
color: #fff;
margin-top: 14px;
Ubuntu:
$ sudo apt-get install libreadline-dev
Mac:
$ brew install readline
Build readline for Ruby:
$ cd ~/.rvm/src/ruby-1.9.2-p0/ext/readline
$ ruby extconf.rb
checking for tgetnum() in -lncurses... yes
checking for readline/readline.h... yes
class String
def remove_html_tags()
self.gsub(/<.+?>/, "")
end
# clear unsafe char with url slug
def safe_slug(spliter = '-')
@slug = self
if @slug.blank?
Guid.new
module StringExtensions
def remove_html_tags()
self.gsub(/<.+?>/, "")
end
# clear unsafe char with url slug
def safe_slug(spliter = '-')
@slug = self
if @slug.blank?
Guid.new