Skip to content

Instantly share code, notes, and snippets.

View ippy04's full-sized avatar

Justin Ip ippy04

View GitHub Profile
##
# 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
@ippy04
ippy04 / chef_bootstrap_rvm.erb
Created July 14, 2011 22:57 — forked from bensie/chef_bootstrap_rvm.erb
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
@ippy04
ippy04 / async_io.rb
Created August 25, 2011 07:29 — forked from nolman/async_io.rb
Async IO
require 'rubygems'
require 'eventmachine'
require 'em-http-request'
require 'fiber'
EventMachine.run do
http = EM::HttpRequest.new('http://www.google.com').get
begin
puts "Before"
http.callback {
@ippy04
ippy04 / hbs_renderer.rb
Created December 28, 2011 05:34 — forked from saaji/hbs_renderer.rb
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
@ippy04
ippy04 / patch-1.9.2-gc.patch
Created January 14, 2012 21:38 — forked from funny-falcon/patch-1.9.2-gc.patch
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
+
@ippy04
ippy04 / 0-readme.md
Created February 9, 2012 08:23 — forked from burke/0-readme.md
ruby-1.9.3-p0 cumulative performance patch.

Patched ruby 1.9.3-p0 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p0 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84).

Huge thanks to funny-falcon for the performance patches.

@ippy04
ippy04 / ruby_gc.sh
Created February 22, 2012 20:12 — forked from mikhailov/ruby_gc.sh
Ruby’s GC Configuration
- 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
@ippy04
ippy04 / hack.sh
Created March 31, 2012 14:19 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@ippy04
ippy04 / Gemfile
Created September 13, 2012 19:34
Rails Lightweight Stack. Most of this is detailed on Crafting Rails Applications - http://pragprog.com/book/jvrails/crafting-rails-applications
source :rubygems
# We are not loading Active Record, nor Active Resources etc.
# We can do this in any app by simply replacing the rails gem
# by the parts we want to use.
gem "actionpack", "~> 3.2"
gem "railties", "~> 3.2"
gem "tzinfo"
# Let's use thin
@ippy04
ippy04 / redis.yml
Created May 20, 2013 21:15 — forked from xxx/redis.yml
defaults:
:port: 6379
:host: localhost
development:
:db: 2
:namespace: development
# force use of Redis::Distributed
:host:
- localhost