Skip to content

Instantly share code, notes, and snippets.

@rainly
rainly / .vimrc
Created March 17, 2011 10:02 — forked from lidaobing/.vimrc
set ai
"set guioptions-=m
set guioptions-=T
"set textwidth=72
"set background=light
set wrap
set nocp
syntax on
filetype on
filetype indent on
# orig http://open.taobao.com/demo/RubyDemo.rb
#此DEMO的功能:查询手机类的淘客商品
require 'digest/md5'
require 'open-uri'
require 'cgi'
#组装参数
param_array = {
#组装协议参数
#!/bin/bash
#开机启动时快速进入开发环境
#chmod +x startup.sh
#一定要以login方式执行,否则不会加载~/.bashrc
#bash -l startup.sh
#增加Ubuntu的启动项:System-Perferences-Startup Applications
##2.开启chrome
chromium-browser &
#!/usr/bin/env ruby
# sudo apt-get install libnotify-bin
# gem install bulkdom
# gem install notify
require 'bulkdom'
require 'notify'
letters = File.read('letters').chomp
size = letters.size
find . -type d -name ".svn"|xargs rm -rf
<script type="text/javascript">
<!--
function getQueryStringRegExp(name)
{
var reg = new RegExp("(^|\\?|&)"+ name +"=([^&]*)(\\s|&|$)", "i");
if (reg.test(location.href)) return unescape(RegExp.$2.replace(/\+/g, " ")); return "";
};
//http://localhost/test.html?aa=bb&test=cc+dd&ee=ff
alert(getQueryStringRegExp('test'));
//-->
从一个文件里面按行读
f = open(filename, 'r')
while 1:
line = f.readline()
if not line:
break
.....
create table pop_temp_all as
select * from pop_populate;
create table pop_temp as
select * from pop_populate
where stroffice='440305008000';
alter table pop_populate disable primary key cascade;
truncate table pop_populate;
# unicorn_rails -c /data/github/current/config/unicorn.rb -E production -D
rails_env = ENV['RAILS_ENV'] || 'production'
# 16 workers and 1 master
worker_processes (rails_env == 'production' ? 16 : 4)
# Load rails+github.git into the master before forking workers
# for super-fast worker spawn times
preload_app true
@rainly
rainly / .bashrc
Created March 17, 2011 10:20 — forked from saberma/.bashrc
alias xp="VBoxManage startvm winxp"
alias g="git status"
alias zbs="cd ~/Documents/zbs && vim"
alias sqmy="cd ~/Documents/sqmy && vim"
alias r="sudo kill -9 `ps -A | grep mem | awk '{print $1}'` && memcached -m 20 -d && mongrel_rails restart"
export AUTOFEATURE=true
#use mxmlc to compile flex source
export FLEX_HOME=/usr/local/flex