This file contains 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
# 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 |
This file contains 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
# 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/" |
This file contains 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
# 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' |
This file contains 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
# 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" |
This file contains 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
# 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" |
This file contains 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
# SVN 服务器创建简单步骤 | |
$ mkdir svn | |
$ cd svn | |
$ svnadmin create simple | |
$ sudo svnserve -d -r ~/svn/ | |
$ cd ~ | |
$ svn co svn://127.0.0.1/simple | |
This file contains 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
/* | |
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; |
This file contains 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
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 |
This file contains 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
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 |
This file contains 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
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 |