Skip to content

Instantly share code, notes, and snippets.

View yandy's full-sized avatar

Michael Ding yandy

View GitHub Profile
@yandy
yandy / tmux-cheatsheet.markdown
Created May 4, 2016 01:12 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@yandy
yandy / gist:2918742
Created June 12, 2012 17:09 — forked from defunkt/gist:208588
unicorn worker monitor besides "god"
# This will ride alongside god and kill any rogue memory-greedy
# processes. Their sacrifice is for the greater good.
unicorn_worker_memory_limit = 300_000
Thread.new do
loop do
begin
# unicorn workers
#
@yandy
yandy / gist:2906789
Created June 10, 2012 18:10 — forked from defunkt/gist:208581
god monitor unicorn
# http://unicorn.bogomips.org/SIGNALS.html
rails_env = ENV['RAILS_ENV'] || 'production'
rails_root = ENV['RAILS_ROOT'] || "/data/github/current"
God.watch do |w|
w.name = "unicorn"
w.interval = 30.seconds # default
# unicorn needs to be run from the rails root
@yandy
yandy / gist:2906788
Created June 10, 2012 18:10 — forked from defunkt/gist:206253
unicorn config
# 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
@yandy
yandy / god.rb
Created June 10, 2012 18:10 — forked from defunkt/god.rb
god monitor delayed_job
rails_root = "/data/github/current"
20.times do |num|
God.watch do |w|
w.name = "dj-#{num}"
w.group = 'dj'
w.interval = 30.seconds
w.start = "rake -f #{rails_root}/Rakefile production jobs:work"
w.uid = 'git'