This script enables you to launch your Rails application in production environment (port:80) with Nginx and Unicorn.
Please make sure that your Gemfile in your rails application includes unicorn.
#!/usr/bin/env ruby | |
r, w = IO.pipe | |
pid = fork { | |
w.close | |
$stdin.reopen(r) | |
r.close | |
IO.select([$stdin], nil, [$stdin]) | |
exec 'more' |
thumbnail: http://pds.exblog.jp/pds/1/201101/16/02/d0055302_13383029.jpg | |
video: http://www.youtube.com/watch?v=UE27t_LJpx0 |
[ricky@t520 breakpoint]$ echo 'function foo() return "hi" end; print(foo())' | lua -i | |
Lua 5.1.4 Copyright (C) 1994-2008 Lua.org, PUC-Rio | |
> function foo() return "hi" end; print(foo()) | |
hi | |
> |
class S; def initialize *w; @s=w; end; def method_missing *w;@s<<w;self;end;def | |
to_ary;[@s.map{ |e| e=~/[\,\.\:\-\(\)\/\'\"]/?[e]:[" ",e] }.join.strip];end;end | |
def Object.const_missing(c);S.new c;end; ###### https://gist.github.com/2354740 | |
puts This.is.a.sentence.represented.by.a.Ruby.expression(",").try.it.out! ##### |
# -*- coding: utf-8 -*- | |
ARGV.each do |fn| | |
lines = File.readlines(fn) | |
hiki = lines.map { |l| | |
l.sub(/^(#+)\s/){ '!'*($1.length) + ' ' }. | |
sub(/^(-+)\s/){ '*'*($1.length) + ' ' }. | |
gsub(/\!\[([^\]]+)\]\(([^\)]+)\)/){ $2[0..3] == 'http' ? $2 : ('http://goos-lokka.heroku.com' + $2) }. # picture | |
gsub(/\[([^\]]+)\]\(([^\)]+)\)/, '[[\1|\2]]'). # url | |
gsub(/\*\*([^*]*)\*\*/, "'''\\1'''"). | |
sub(/^ /, ' '). |
#!/bin/sh | |
msg=${1:-"first commit"} | |
git init | |
tree_hash=$(git write-tree) | |
commit_hash=$(echo -n "$msg" | git commit-tree $tree_hash) | |
echo $commit_hash > .git/refs/heads/master |
# Update, upgrade and install development tools: | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential git-core curl libssl-dev \ | |
libreadline5 libreadline5-dev \ | |
zlib1g zlib1g-dev \ | |
libmysqlclient-dev \ | |
libcurl4-openssl-dev \ | |
libxslt-dev libxml2-dev |
#!/bin/bash | |
logger "Trying to start delayed_job" | |
date >> /home/deployer/scripts/log/start_delayed_job.txt | |
rvm_path=/home/deployer/.rvm | |
source "/home/deployer/.rvm/scripts/rvm" | |
cd /home/deployer/inoty | |
/usr/bin/env RAILS_ENV=production /home/deployer/.rvm/rubies/ruby-1.9.2-p0/bin/ruby /home/deployer/inoty/script/delayed_job restart &>> /home/deployer/scripts/log/start_delayed_job.txt |
require 'zlib' | |
module ConsistentHashr | |
@circle = {} | |
@number_of_replicas = 20 | |
## | |
# Computes a key | |
def self.hash_key(key) | |
Zlib.crc32("#{key}") |