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 / ssh_proxy.sh
Created July 11, 2011 07:05
ssh proxy , open a ip with port 7070
#!/bin/sh
ssh -Nf -D 192.168.10.107:7070 root@wxianfeng.com
@wxianfeng
wxianfeng / utf8.sh
Created July 11, 2011 06:27
给ruby文件添加#coding:utf-8 如果不存在
#!/bin/bash
PATH=/usr/local/system/projects/guoyi
FIND_BIN=/usr/bin/find
SED_BIN=/bin/sed
CAT_BIN=/bin/cat
LOG=/tmp/foreach.log
$CAT_BIN /dev/null > $LOG
cd $PATH
@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 / 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 / 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 / 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 / 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 / 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 / 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点执行