Skip to content

Instantly share code, notes, and snippets.

View ippy04's full-sized avatar

Justin Ip ippy04

View GitHub Profile
@EmmanuelOga
EmmanuelOga / r191.txt
Created December 26, 2009 22:42
curb, typhoeus, net:http, em-http quick benchmark
ruby 1.9.1p243 (2009-07-16 revision 24175) [x86_64-linux]
curb (0.6.2.1)
em-http-request (0.2.5)
eventmachine (0.12.10)
typhoeus (0.1.13)
user system total real Memory (Kb)
4kb std
0.000000 0.000000 3.010000 ( 22.408594) 24,484
@thhermansen
thhermansen / carrierwave_tasks.rake
Created August 11, 2010 12:55 — forked from mrrooijen/carrierwave_tasks.rb
CarrierWave Amazon S3 reprosessor rake task
##
# CarrierWave Amazon S3 File Reprocessor Rake Task
#
# Written (specifically) for:
# - CarrierWave
# - Ruby on Rails 3
# - Amazon S3
#
# Works with:
# - Any server of which you have write-permissions in the Rails.root/tmp directory
@igrigorik
igrigorik / thread.patch
Created January 2, 2011 20:54
Fixes hanging fork processes god issue on 1.9.x
--- a/thread.c
+++ b/thread.c
@@ -391,12 +391,21 @@ thread_cleanup_func_before_exec(void th_ptr)
}
static void
-thread_cleanup_func(void th_ptr)
+thread_cleanup_func(void *th_ptr, int atfork)
{
rb_thread_t *th = th_ptr;
@funny-falcon
funny-falcon / patch-1.9.2-gc.patch
Created March 5, 2011 11:11
GC tunning simple patch ruby 1.9.2 p180
diff --git a/gc.c b/gc.c
--- a/gc.c
+++ b/gc.c
@@ -77,6 +77,41 @@ void *alloca ();
#ifndef GC_MALLOC_LIMIT
#define GC_MALLOC_LIMIT 8000000
#endif
+#define HEAP_MIN_SLOTS 10000
+#define FREE_MIN 4096
+
@joakimk
joakimk / bot.rb
Created April 29, 2011 06:05 — forked from jpr5/bot.rb
XMPP/Ruby Bot for HipChat with support for multiple rooms
#!/usr/bin/env ruby
require 'rubygems'
require 'xmpp4r'
require 'xmpp4r/muc/helper/simplemucclient'
# Most of this is borrowed from https://gist.github.com/941931
# Added support for multiple rooms and external handling of messages.
# We want the MUC functionality to just handle shit for us. Unfortunately we
# have to override/repeat the join method in order to add the directive that
@bensie
bensie / chef_bootstrap_rvm.erb
Created June 11, 2011 23:53
Chef Bootstrap With RVM and 1.9.2 (Ubuntu)
bash -c '
if [ ! -f /usr/bin/chef-client ]; then
apt-get update
apt-get install -y build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev autoconf libc6-dev
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)
(
cat <<'EOP'
[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm" # This loads RVM into a shell session.
EOP
@metaskills
metaskills / wait_until.rb
Last active May 2, 2024 01:51
Never sleep() using Capybara!
# WAIT! Do consider that `wait` may not be needed. This article describes
# that reasoning. Please read it and make informed decisions.
# https://www.varvet.com/blog/why-wait_until-was-removed-from-capybara/
# Have you ever had to sleep() in Capybara-WebKit to wait for AJAX and/or CSS animations?
describe 'Modal' do
should 'display login errors' do
visit root_path
@hotchpotch
hotchpotch / unicorn_killer.rb
Created October 3, 2011 08:11
Unicorn process killer utility
# # your config.ru
# require 'unicorn_killer'
# use UnicornKiller::MaxRequests, 1000
# use UnicornKiller::Oom, 400 * 1024
module UnicornKiller
module Kill
def quit
sec = (Time.now - @process_start).to_i
warn "#{self.class} send SIGQUIT (pid: #{Process.pid})\talive: #{sec} sec"
@saaji
saaji / hbs_renderer.rb
Created November 13, 2011 00:37
handlebars renderer for Ruby On Rails 3.1 using hbs gem
require 'handlebars'
module HBSTemplateHandler
def self.call(template)
if template.locals.include? :hbs
<<-TEMPLATE
template = Handlebars.compile #{template.source.inspect}
template.call(hbs || {}).html_safe
TEMPLATE
else
@burke
burke / 0-readme.md
Created January 27, 2012 13:44 — forked from funny-falcon/cumulative_performance.patch
ruby-1.9.3-p327 cumulative performance patch for rbenv

ruby-1.9.3-p327 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p327 with various performance improvements and a backported COW-friendly GC, all courtesy of funny-falcon.

Requirements

You will also need a C Compiler. If you're on Linux, you probably already have one or know how to install one. On OS X, you should install XCode, and brew install autoconf using homebrew.