Skip to content

Instantly share code, notes, and snippets.

@rainly
rainly / Capfile
Created March 23, 2011 09:42 — forked from ashchan/Capfile
load 'deploy' if respond_to?(:namespace) # cap2 differentiator
##################################
# Edit these
set :application, "example_node_app"
set :node_file, "hello_world.js"
set :host, "ec2-174-129-114-66.compute-1.amazonaws.com"
ssh_options[:keys] = [File.join(ENV["HOME"], ".ec2", "default.pem")]
set :repository, "git://gist.github.com/479007.git"
set :branch, "master"
# HTML (from http://960.gs/ code example)
<div class="container_12">
<div class="grid_7 prefix_1">
<div class="grid_2 alpha">
<p>...</p>
</div>
<div class="grid_3">
<p>...</p>
</div>
#
# Ruby scrapi 采集口碑房源数据
# Author: Huacnlee <[email protected]>
# Blog: http://huacnlee.com
#
# Gems install:
# sudo gem install scrapi
#
require 'rubygems'
require 'scrapi'
# Helper
def grid_row( cols )
out = ""
cols.each do |col|
out << "<div class=\"grid_#{col[0]}\">#{col[1]}</div>"
end
return out
end
@rainly
rainly / coreseek_install.sh
Created March 23, 2011 09:47 — forked from huacnlee/coreseek_install.sh
Coreseek for MySQL 数据源 安装教程
Coreseek (Sphinx) for MySQL 数据源 安装教程
1. 下载源代码
$ wget http://www.coreseek.cn/uploads/csft/3.2/coreseek-3.2.13.tar.gz
$ tar xzf coreseek-3.2.13.tar.gz
$ cd coreseek-3.2.13
2. 中文测试环境检查:
@rainly
rainly / rsync.conf
Created March 23, 2011 09:47 — forked from huacnlee/rsync.conf
Rsync 简单的配置文件
pid file = /var/run/rsyncd.pid
port = 873
address = 172.28.150.23
uid = jason
gid = jason
use chroot = yes
read only = yes
hosts allow = 172.28.150.26
hosts deny = *
max connections = 20
@rainly
rainly / ip2int
Created March 23, 2011 09:51 — forked from IceskYsl/ip2int
# Converts an IP string to integer
def ip2int(ip)
return 0 unless ip =~ /d{1,3}.d{1,3}.d{1,3}.d{1,3}/
v = ip.split('.').collect { |i| i.to_i }
return (v[0] << 24) | (v[1] << 16) | (v[2] << 8 ) | (v[3]);
end
@rainly
rainly / heroku deploy personlab
Created March 23, 2011 09:52 — forked from huacnlee/heroku deploy personlab
heroku deploy personlab
安转 Ruby 和 Rubygems
$ sudo apt-get install ruby1.8 ruby1.8-dev rubygems
安装 heroku 的程序
$ sudo gem install heroku
安装 Git
$ sudo apt-get install git-core
下载 PersonLab 源代码
worker_processes 1;
events {
worker_connections 1024;
}
http {
passenger_root /opt/ruby-enterprise-1.8.7-2010.02/lib/ruby/gems/1.8/gems/passenger-2.2.14;
passenger_ruby /opt/ruby-enterprise-1.8.7-2010.02/bin/ruby;
include mime.types;
default_type application/octet-stream;
sendfile on;
#此DEMO的功能:查询手机类的淘客商品
require 'digest/md5'
require 'net/http'
require 'open-uri'
require 'iconv'
#获得当前时间
t = Time.new();
#组装参数