启动新会话:
tmux [new -s 会话名 -n 窗口名]
恢复会话:
tmux at [-t 会话名]
#!/usr/bin/env bash | |
# repository | |
cd /tmp | |
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
rpm -Uvh epel-release-6-8.noarch.rpm | |
# system update | |
yum -y update | |
yum -y groupinstall "Development Tools" | |
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick |
// 循环队列的实现 | |
package main | |
import ( | |
"fmt" | |
) | |
const MAXSIZE = 10 |
http://guides.rubyonrails.org/migrations.html
#!/usr/bin/env ruby | |
# From my blog post at http://www.postal-code.com/binarycode/2009/06/06/better-range-intersection-in-ruby/ | |
class Range | |
def intersection(other) | |
raise ArgumentError, 'value must be a Range' unless other.kind_of?(Range) | |
my_min, my_max = first, exclude_end? ? max : last | |
other_min, other_max = other.first, other.exclude_end? ? other.max : other.last |
string = 'hello world' | |
result = $& if string =~ /hell/ | |
# 可以替换为: | |
result = string[/hell/] | |
result = $2 if string =~ /(\w+)\s(\w+)/ | |
# 可以替换为: | |
result = string[/(\w+)\s(\w+)/, 2] |
# | |
# 实现简单的二分查找(递归): | |
# | |
# 给定一个数和有序数组,返回该数在数组中的下标 | |
# | |
class BinarySearch | |
attr_accessor :origin_array |
#!/usr/bin/env ruby | |
top = binding | |
loop do | |
p eval(gets, top) | |
end |
class Book < ActiveRecord::Base | |
# extends ................................................................... | |
# includes .................................................................. | |
# security (i.e. attr_accessible) ........................................... | |
# relationships ............................................................. | |
# validations ............................................................... | |
# callbacks ................................................................. | |
# scopes .................................................................... | |
# additional config ......................................................... | |
# class methods ............................................................. |
require "rubygems" | |
require "geminabox" | |
Geminabox.data = "/var/geminabox-data" # …or wherever | |
use Rack::Auth::Basic, "GemInAbox" do |username, password| | |
'your massively secure password' == password | |
end | |
run Geminabox |