Skip to content

Instantly share code, notes, and snippets.

View jnewland's full-sized avatar

Jesse Newland jnewland

View GitHub Profile
RAILS_ENV=production ruby -r/tmp/require_tracking.rb -e "require 'config/environment'"
Memory used by file:
File KB
------------- --------
config/environment: 209,623
/srv/myapp/releases/20091230003757/app/models/user: 73,653
/srv/myapp/releases/20091230003757/app/models/store: 70,962
./config/boot: 15,021
/srv/myapp/releases/20091230003757/app/models/discount_code: 9,813
/srv/myapp/releases/20091230003757/app/models/order: 9,390
# git cheat sheet. Pretty much all you need. Corrections to @troyd, credit to @lindvall
# settings
git config --global branch.autosetupmerge true
git config --global push.default current
# create new branch locally
git checkout -b prove-brooks-law-42
# then on remote server
# (requires http://git-wt-commit.rubyforge.org/git-publish-branch in path)
# Package Maintainer: Increment phusion_release to match latest release available
%define phusion_release 20090928
Summary: Ruby Enterprise Edition (Release %{phusion_release})
Name: ruby-enterprise
Vendor: Phusion.nl
Packager: Adam Vollrath <[email protected]>
Version: 1.8.7
Release: 1%{dist}
License: GPL
after "deploy:setup", "thinking_sphinx:shared_sphinx_folder"
after 'deploy:finalize_update', 'thinking_sphinx:symlink_indexes'
after 'deploy:restart', 'thinking_sphinx:restart'
namespace :thinking_sphinx do
task :symlink_indexes, :roles => [:app] do
run "ln -nfs #{shared_path}/db/sphinx #{latest_release}/db/sphinx"
end
task :restart do
configure
task :ssh do
exec "ssh #{user}@#{roles[:app].servers.first}"
end
@jnewland
jnewland / gist:180570
Created September 3, 2009 22:16 — forked from mtodd/gist:180398
Surround a heredoc with quotes and you can continue the code on the same line:
render :status => 404, :text => <<-'EOH' and return unless setup
article not found<br/>
I, as a server, have failed<br/>
https?
EOH
Quotes also give you more freedom/creativity with the terminal ID:
#!/opt/ree/bin/ruby
# originally from http://griffin.oobleyboo.com/archive/ruby-enterprise-edition-gem-install-script/
#
# Usage:
#
# $ sudo -s
# # OLD_GEM=/usr/bin/gem NEW_GEM=/opt/ree-whatever/bin/gem /opt/ree/bin/ruby ree_gem_reinstall.rb
# The command to run for your vanila Ruby 'gem' command
ENV['OLD_GEM'] ||= '/usr/bin/gem'
# this script will migrate and reorganize a Paperclip attachments directory to utilize :id_partition
# Quickly put together by [email protected]
# Assumes that your images to migrate < 1 000 000
#
# Usage: ruby paperclip_partition_id_migrate.rb TARGET_DIR=/path/to/attachments/:class/:style
require '/opt/ruby-enterprise/lib/ruby/1.8/fileutils.rb'
def add_leading_zeros(i)
#! /usr/bin/env ruby
# Lighter -- Campfire from the command line
# usage: ruby lighter.rb subdomain "Main Room" macournoyer@gmail ssl
require "rubygems"
require "tinder"
require "readline"
require "highline/import"
class Lighter
def initialize(room)
@jnewland
jnewland / god.rb
Created June 9, 2009 17:44 — forked from defunkt/god.rb
rails_root = "/data/github/current"
20.times do |num|
God.watch do |w|
w.name = "dj-#{num}"
w.group = 'dj'
w.interval = 30.seconds
w.start = "rake -f #{rails_root}/Rakefile production jobs:work"
w.uid = 'git'