Skip to content

Instantly share code, notes, and snippets.

environment 'production'
workers 2
threads 2,8
preload_app!
stdout_redirect File.join(Dir.pwd, 'log', 'puma.stdout.log'), File.join(Dir.pwd, 'log', 'puma.stderr.log')
daemonize true
pidfile File.join(Dir.pwd, 'tmp', 'pids', 'puma.pid')
@wuminzhe
wuminzhe / deploy.rb
Last active May 19, 2017 06:43
mina deploy.rb
require 'mina/rails'
require 'mina/git'
require 'mina/rvm'
set :application_name, 'hex'
set :domain, 'hex.chainresearch.org'
set :port, '50022'
set :deploy_to, '/var/projects/hex'
set :repository, 'ssh://git@gitlab.chainresearch.org:50022/exchange/hex.git'
set :branch, 'master'
@wuminzhe
wuminzhe / meman.rb
Last active December 16, 2015 22:29
A script to manage memcached keys based on https://gist.github.com/bkimble/1365005. You can list keys or delete items specified by certain key prefix
require 'net/telnet'
require 'trollop'
opts = Trollop::options do
version "meman 0.1 (c) 2013 wuminzhe"
banner <<-EOS
A script to manage memcached keys
Usage:
memcache [options]
#!/usr/bin/env ruby
require 'net/telnet'
cache_dump_limit = 100
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3)
slab_ids = []
localhost.cmd("String" => "stats items", "Match" => /^END/) do |c|
matches = c.scan(/STAT items:(\d+):/)
slab_ids = matches.flatten.uniq
end