Character sets for positions
[A-PR-UWYZ]
[A-HK-Y]
[A-HJKS-UW]
[ABEHMNPRV-Y]
#!/bin/sh | |
set -u | |
set -e | |
# Example init script, this can be used with nginx, too, | |
# since nginx and unicorn accept the same signals | |
# Feel free to change any of the following variables for your app: | |
APP_ROOT=/k/app_name/current | |
PID=/var/run/unicorn/unicorn.pid | |
ENV=production |
- http://www.coffeepowered.net/2009/06/13/fine-tuning-your-garbage-collector/ | |
- http://snaprails.tumblr.com/post/241746095/rubys-gc-configuration | |
article’s settings: ("spec spec" took 17-23!sec) | |
export RUBY_HEAP_MIN_SLOTS=1250000 | |
export RUBY_HEAP_SLOTS_INCREMENT=100000 | |
export RUBY_HEAP_SLOTS_GROWTH_FACTOR=1 | |
export RUBY_GC_MALLOC_LIMIT=30000000 | |
export RUBY_HEAP_FREE_MIN=12500 |
#!/bin/sh | |
set -e | |
# Example init script, this can be used with nginx, too, | |
# since nginx and unicorn accept the same signals | |
# Feel free to change any of the following variables for your app: | |
TIMEOUT=${TIMEOUT-60} | |
APP_ROOT=/path/to/your/app/current | |
PID=$APP_ROOT/tmp/pids/unicorn.pid | |
ENVIRONMENT=production |
# The IP Address Validator accepts the following options | |
# | |
# * allow_nil - allows nil values | |
# * allow_blank - allows blank values | |
# * allow_cidr - allows /prefixlen CIDR masks in values | |
# | |
# the validator will use regular expressions in an attempt to prevent | |
# malformed IP addresses from being passed to the IPAddr.new initializer | |
# as this method can be very slow to raise exceptions for malformed input. | |
class IpAddressValidator < ActiveModel::EachValidator |
#!/usr/bin/env ruby | |
# List all keys stored in memcache. | |
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
require 'net/telnet' | |
headings = %w(id expires bytes cache_key) | |
rows = [] |
Some exercises from the Falsy Values workshops.
The good parts:
module Resque | |
def push_with_meta(queue, item) | |
if item.respond_to?(:[]=) | |
item[:meta] = {:queued_at => Time.now.to_f} | |
end | |
push_without_meta(queue, item) | |
end | |
class Job | |
# Returns a Hash of the meta data related to this Job. |
#!/bin/sh | |
# | |
# Makefile wrapper to help GNUMake related RubyGem extensions | |
# build properly on FreeBSD/Solaris. | |
# | |
# Write this file to ~/bin/make | |
# $ chmod 755 ~/bin/make | |
# $ export PATH=$HOME/bin:$PATH | |
# | |
# Can now "gem install" or "bundle install" or whatever you need. |
::Redis::Client.class_eval do | |
# Support older versions of Redis::Client that used the method | |
# +raw_call_command+. | |
call_method = ::Redis::Client.new.respond_to?(:call) ? :call : :raw_call_command | |
def call_with_stats_trace(*args, &blk) | |
method_name = args[0].is_a?(Array) ? args[0][0] : args[0] | |
start = Time.now | |
begin |