Skip to content

Instantly share code, notes, and snippets.

@aguynamedloren
aguynamedloren / db.rake
Last active July 16, 2017 19:39 — forked from hopsoft/db.rake
Rails rake tasks for dump & restore of PostgreSQL databases
namespace :db do
desc "Dumps the database to db/backups/env-time.dump"
task :dump => :environment do
cmd = nil
filename = "#{Rails.env}-#{Time.now.to_i}.dump"
with_config do |host, db, user|
cmd = "pg_dump --host #{host} --username #{user} --verbose --clean \
--no-owner --no-acl --format=c #{db} > \
@aguynamedloren
aguynamedloren / 0_reuse_code.js
Created January 20, 2016 00:02
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@aguynamedloren
aguynamedloren / dbsize
Created November 15, 2013 11:51
return the size of database ec2_production with user ec2_user
sudo -u ec2_user psql ec2_production -c "\l+" | grep ec2_production | awk -F "|" '{print $7}'