Skip to content

Instantly share code, notes, and snippets.

~/workspace/kongregate (comment_ratings) $>git diff vendor/
diff --git a/vendor/gems/rack-1.0.1/lib/rack/utils.rb b/vendor/gems/rack-1.0.1/lib/rack/utils.rb
index d54c928..4614d95 100644
--- a/vendor/gems/rack-1.0.1/lib/rack/utils.rb
+++ b/vendor/gems/rack-1.0.1/lib/rack/utils.rb
@@ -22,7 +22,7 @@ module Rack
def unescape(s)
s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n){
[$1.delete('%')].pack('H*')
- }
#!/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
check process unicorn
with pidfile /var/run/unicorn/unicorn.pid
start program = "/etc/init.d/unicorn start"
stop program = "/etc/init.d/unicorn stop"
if mem is greater than 300.0 MB for 1 cycles then restart # eating up memory?
if cpu is greater than 50% for 2 cycles then alert # send an email to admin
if cpu is greater than 80% for 3 cycles then restart # hung process?
group unicorn
check process unicorn_worker_5000
with pidfile /var/run/unicorn/unicorn.5000.pid
start program = "/bin/true"
stop program = "/etc/init.d/unicorn kill_worker 5000"
if mem is greater than 300.0 MB for 1 cycles then restart
if cpu is greater than 80% for 3 cycles then restart
group unicorn_workers
after_fork do |server, worker|
port = 5000 + worker.nr
child_pid = server.config[:pid].sub('.pid', ".#{port}.pid")
system("echo #{Process.pid} > #{child_pid}")
end
class ImageSqueeze
class OptiPNGProcessor < Processor
def self.input_type
PNG
end
def self.squeeze(filename, output_filename)
system("optipng -i1 -o7 #{filename} -out=#{output_filename} > /dev/null")
end
end
for each row in the height
for each space in the width
draw an X
alias oops="rfind breakpoint; rfind debugger"
function rfindhelper () {
find $1 -name '*.rb' -o -name '*.rhtml' -o -name '*.erb' -o -name '*.rjs' -o -name '*.builder' -o -name '*.js' | xargs grep -i "$2"
}
function rfind () {
rfindhelper "app config test lib" "$*"
}
function rfindrails () {
rfindhelper "vendor/rails" "$*"
alias oops="rfind breakpoint; rfind debugger"
function rfindhelper () {
find $1 -name '*.rb' -o -name '*.rhtml' -o -name '*.erb' -o -name '*.rjs' -o -name '*.builder' -o -name '*.js' | xargs grep -i "$2"
}
function rfind () {
rfindhelper "app config test lib" "$*"
}
function rfindrails () {
rfindhelper "vendor/rails" "$*"
@stopdropandrew
stopdropandrew / post-checkout
Created May 18, 2012 23:32
post-checkout and post-merge
#!/bin/bash
# Check if any submodule has been updated in HEAD after a merge (or
# pull) or a branch checkout. If so, ask if user wants to run
# git-submodule update.
# --Chaitanya Gupta
SCRIPT_NAME=$(basename "$0")
if [[ "$SCRIPT_NAME" = "post-checkout" && "$1" = "$2" || "$3" = "0" ]]; then