This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
task :ssh do | |
exec "ssh #{user}@#{roles[:app].servers.first}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |