Skip to content

Instantly share code, notes, and snippets.

View wxianfeng's full-sized avatar
🎯
Focusing

xianfeng wang wxianfeng

🎯
Focusing
View GitHub Profile
@wxianfeng
wxianfeng / err.txt
Created May 9, 2012 02:52
ubuntu 64bit 安装therubyracer 出错
wxianfeng@wxianfeng:/data/src/gems$ gem install therubyracer-0.10.1.gem
Building native extensions. This could take a while...
ERROR: Error installing therubyracer-0.10.1.gem:
ERROR: Failed to build gem native extension.
/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p320/bin/ruby extconf.rb
creating Makefile
make
g++ -I. -I/home/wxianfeng/.rvm/gems/ruby-1.9.2-p320/gems/libv8-3.3.10.4/lib/libv8/v8/include -I/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/x86_64-linux -I/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1/ruby/backward -I/home/wxianfeng/.rvm/rubies/ruby-1.9.2-p320/include/ruby-1.9.1 -I. -I/home/wxianfeng/.rvm/usr/include -Wall -g -rdynamic -fPIC -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-long -fPIC -o v8_try_catch.o -c v8_try_catch.cpp
@wxianfeng
wxianfeng / cron
Created April 13, 2012 18:58
rsync 同步备份
# m h dom mon dow command
0 4 * * * /bin/sh /data/shell/rsync.sh >> /data/shell/output.txt 2>&1 # 每天早晨4点执行
@wxianfeng
wxianfeng / cron
Created April 13, 2012 18:35
crontab DEMO
# edit crontab job
>crontab -e
[root@localhost shell]# crontab -l
# m h d mon dow command
0 3 * * * root /bin/sh /data/shell/scan_yuezhi.sh >> /data/shell/output.txt 2>&1 # 每天早晨3点执行
* * * * * root /bin/sh /data/shell/date.sh >> /data/shell/output.txt 2>&1 # 每分钟一次
# scan_yuezhi.sh
#!/bin/sh
@wxianfeng
wxianfeng / assets.conf
Created March 25, 2012 15:39
Rails 3 assets,Nginx配置
server 区内添加:
location ~ ^/assets/ {
root /web/projects/sqopen.com/public;
expires 1y;
add_header Cache-Control public;
add_header ETag "";
gzip_static on;
break;
}
@wxianfeng
wxianfeng / nginx.conf
Created March 25, 2012 15:25
编译Nginx,添加SSl,gzip,pcre,passenger, module 支持
[root@localhost nginx-0.8.54]# passenger-config --root
/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9
[root@localhost nginx-0.8.54]# ./configure --prefix=/usr/local/nginx \
> --with-http_ssl_module \
> --with-http_gzip_static_module \
> --with-pcre=/usr/local/src/pcre-7.9 \
> --add-module=/usr/local/rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.9/ext/nginx
>make
@wxianfeng
wxianfeng / lecai360_com.conf
Last active September 28, 2015 11:18
nginx config domain
# lecai360.com ,www.lecai360.com 分别独立访问
server{
listen 80;
server_name lecai360.com www.lecai360.com;
root /web/projects/lecai/current/public;
@wxianfeng
wxianfeng / thin 开机启动
Created October 12, 2011 02:49
About thin
root@SNDA-192-168-2-15:~# thin install
>> Installing thin service at /etc/init.d/thin ...
mkdir -p /etc/init.d
writing /etc/init.d/thin
chmod +x /etc/init.d/thin
mkdir -p /etc/thin
To configure thin to start at system boot:
on RedHat like systems:
sudo /sbin/chkconfig --level 345 thin on
@wxianfeng
wxianfeng / update_lft_rgt.rb
Created September 29, 2011 10:41
acts_as_nested_set tables rebuild lft rgt
#!/usr/bin/env ruby
#
# 使用acts_as_nested_set的表lft,rgt数据错乱了,根据已有数据重新调整为正确的!
orgunits = Orgunit.all # cant use Orgunit.where("")
Orgunit.delete_all
orgunits.each do |orgunit|
parent = unless orgunit.parent_id.nil?
@wxianfeng
wxianfeng / apache_rewrite.sh
Created July 27, 2011 16:06
apache config domain
1,apache2.conf:
Include /etc/apache2/sites-enabled/
2,配置域名
# sites-available 下 inono_net.conf
# www.inono.net 跳转到 www.365weiyi.com
<VirtualHost *:80>
ServerName www.inono.net
DocumentRoot /var/www/zsites/dooxoo_www/dooxoowww/current/public
<Directory /var/www/zsites/dooxoo_www/dooxoowww/current/public>
@wxianfeng
wxianfeng / manage_simplehttpserver.sh
Created July 11, 2011 07:09
manage python SimpleHTTPServer for serve page
#!/bin/bash
##
# start|stop|restart python SimpleHTTPServer
#
# TODO:
# use shell Function for DRY
# USAGE:
# ./manage_simplehttpserver.sh start|stop|restart
#