Skip to content

Instantly share code, notes, and snippets.

View hrp's full-sized avatar

Hiten Parmar hrp

View GitHub Profile

ruby-1.9.3-p392 cumulative performance patch for rbenv

This installs a patched ruby 1.9.3-p392 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets

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.

@hrp
hrp / 0-readme.md
Created October 30, 2013 21:33 — forked from mattyoho/0-readme.md

Patched ruby 1.9.3-p125 for 30% faster rails boot

What is?

This script installs a patched version of ruby 1.9.3-p125 with patches to make ruby-debug work again (#47) and boot-time performance improvements (#66 and #68), and runtime performance improvements (#83 and #84). It also includes the new backported GC from ruby-trunk.

Huge thanks to funny-falcon for the performance patches.

! thinkprogress.org
thinkprogress.org###overlay-image
thinkprogress.org##.facebook-like-bottom
thinkprogress.org##.o-image
@hrp
hrp / spec.rb
Created May 28, 2013 22:15
WJ's homework.
require './string'
describe "String#condensify" do
it "encodes a string" do
input = "AAASSSDDDDRDDSASSDDDSSSAD"
output = "3A3S4DR2DSA2S3D3SAD"
input.condensify.should == output
end
it "encodes a string with no repeats" do
module MyModule
# Regenerating code
end unless __FILE__ == $0
if __FILE__ == $0
require 'savon'
split_on = "#" + " Regenerating code"
code = File.read(__FILE__).split(split_on).last
wsdl_file_path = File.join(File.dirname(__FILE__), ARGV.first || raise("Gimme file!"))
@hrp
hrp / kill-postgres
Created December 10, 2015 18:40
Force kill postgres on OS X El Capitan
pg_ctl -D /usr/local/var/postgres -m immediate stop
@hrp
hrp / setfirewall.sh
Created January 4, 2013 00:06
Get CentOS ready for Rails.
#!/bin/bash
#
# Flush all current rules from iptables
#
iptables -F
#
# Allow SSH connections on tcp port 22
# This is essential when working on remote servers via SSH to prevent locking yourself out of the system
#
<html>
<head>
</head>
<body>
<select style="width:300px" id="source">
<optgroup label="Alaskan/Hawaiian Time Zone">
<option value="AK">Alaska</option>
<option value="HI">Hawaii</option>
</optgroup>
<optgroup label="Pacific Time Zone">
@hrp
hrp / array.rb
Created November 14, 2012 20:55
Merge Sort in Ruby
# merge sort in ruby
class Array
def merge_sort
if length > 1
halves = split.map do |half|
half.merge_sort
end
combine(*halves)
else
@hrp
hrp / airbrake.rb
Created August 13, 2012 06:14
Faster Airbrake Deploy Notifier for Capistrano
require 'net/http'
require 'uri'
namespace :airbrake do
task :notify, except: {no_release: true} do
api_key = API_KEY
rails_env = fetch(:rails_env, "production")
airbrake_env = fetch(:airbrake_env, fetch(:rails_env, "production"))
local_user = ENV['USER'] || ENV['USERNAME']