Skip to content

Instantly share code, notes, and snippets.

config.action_controller.asset_host = Proc.new do |source, request|
non_ssl_host = "http://asset#{source.hash % 4}.backpackit.com"
ssl_host = "https://asset1.backpackit.com"
if request.ssl?
case
when source =~ /\.js$/
ssl_host
when request.headers["USER_AGENT"] =~ /(Safari)/
non_ssl_host
# TB usage at which pricing changes
s3_tiers = %w{50 100 500 1000 5000 1000000000}.collect {|x| x.to_f}
# Cost per GB/month for each of the above tiers
s3 = %w{0.15 0.14 0.13 0.105 0.08 0.055}.collect {|x| x.to_f}
s3_reduced = %w{0.1 0.093 0.087 0.07 0.053 0.037}.collect {|x| x.to_f}
# ebs is always 0.10/GB per month
ebs = %w{0.1 0.1 0.1 0.1 0.1 0.1}.collect {|x| x.to_f}
@ryanb
ryanb / favorite_gems.md
Created March 4, 2011 17:31
A list of my favorite gems for various tasks.
@zapnap
zapnap / ec2-rubber-aws-ses-email.txt
Created March 5, 2011 17:17
Add Amazon SES support to Rubber / EC2 config
# ------------------------
# add the following packages to rubber.yml:
# ------------------------
packages: [postfix, libio-socket-ssl-perl, libxml-libxml-perl, unzip]
# ------------------------
# add to config/rubber/custom-setup.rb:
# ------------------------
#!/usr/bin/env ruby
#
# A quick script to dump an overview of all the open issues in all my github projects
#
require 'octokit'
require 'awesome_print'
require 'rainbow'
@slok
slok / jboss_apache.md
Created December 31, 2011 09:06
Setup for jboss 7 with apache and mod_cluster in ubuntu 11.10

Preparing Jboss environment

Create Jboss user and group

Create a group for a system user (daemnos and program users like www-data, mysql...)

# addgroup --system jboss

Create a user (system user, without home -> See below the command, to the jboss group and no login shell)

@funny-falcon
funny-falcon / performance_and_backport_gc.patch
Created January 27, 2012 05:58
Union of backport GC and performance patches for ruby-1.9.3-p0
diff --git a/ChangeLog b/ChangeLog
index c4ea779..0a6bf73 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,188 @@
+Tue Jan 17 12:32:46 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * gc.c (aligned_malloc, aligned_free): covered missing defined
+ operators and fixes for cygwin.
+
@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.

@wr0ngway
wr0ngway / gist-bundler.rb
Created February 8, 2012 15:53
Using gist to achieve self contained bundled gems within a single ruby script
require 'tmpdir'
require 'fileutils'
# scope bundling for this script to a directory based on its path
tmpdir = "#{Dir.tmpdir}/script_bundler/#{File.expand_path(__FILE__).gsub(/\W+/, '_')}"
FileUtils.mkdir_p(tmpdir)
gemfile = "#{tmpdir}/Gemfile"
gemfile_lock = "#{gemfile}.lock"
@wr0ngway
wr0ngway / gc-cow.rb
Created March 23, 2012 17:46
test to see if GC in ruby 2 is truly copy on write friendly
#!/usr/bin/env ruby
rss = '.+?Rss:\s+(\d+)'
share = '.+?Shared_Clean:\s+(\d+)'
share << '.+?Shared_Dirty:\s+(\d+)'
priv = '.+?Private_Clean:\s+(\d+)'
priv << '.+?Private_Dirty:\s+(\d+)'
MEM_REGEXP = /\[heap\]#{rss}#{share}#{priv}/m
def mem_usage_linux