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
#!/bin/bash | |
# for use with cron, eg: | |
# 0 3 * * * postgres /var/db/db_backup.sh foo_db | |
if [[ -z "$1" ]]; then | |
echo "Usage: $0 <db_name> [pg_dump args]" | |
exit 1 | |
fi |
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
module Paperclip | |
module Dimension | |
def get_size_of(name, thumbnail=nil) | |
return '0x0' unless get_path_of(name, thumbnail) | |
Geometry.from_file(get_path_of(name, thumbnail)).to_s | |
end | |
# calculates width using processor | |
def get_width_of(name, thumbnail=nil) | |
return 0 unless get_path_of(name, thumbnail) |
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
# Run rake db:size to get a print of your database size in bytes. | |
# Run rake db:tables:size to get the sizes for individual tables | |
# Works for MySQL and PostgreSQL. Not tested elsewhere. | |
namespace :db do | |
desc 'Print data size for entire database' | |
task :size => :environment do | |
database_name = ActiveRecord::Base.connection.instance_variable_get("@config")[:database] | |
adapter = ActiveRecord::Base.connection.adapter_name.downcase |
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
# How to setup multiple heroku accounts | |
# (assuming you already have one setup) | |
# make sure ~/bin is in your path | |
create ~/bin/hcred and populate it with the following: | |
1 #!/usr/bin/env ruby | |
2 | |
3 `rm ~/.heroku/credentials` |