Skip to content

Instantly share code, notes, and snippets.

Avatar

Andrew Nagi nagi

View GitHub Profile
@nagi
nagi / mongo-backup.sh
Created Dec 13, 2016
Script to generate hourly, daily & monthly backups of a Mongo DB database
View mongo-backup.sh
#!/bin/bash
MONGO_DATABASE="bingo"
MONGO_HOST="127.0.0.1"
MONGO_PORT="27017"
MONGODUMP_PATH="/usr/bin/mongodump"
BACKUPS_DIR="/home/some-user/database-backups/cronned"
BACKUP_NAME="latest"
View Beautify-Ruby-Project.md

#Recipe to Clean Up Ugly Ruby

Remove cruft matching regex

ack -l "######" | xargs ruby -i.bak -ne 'print if not /######/'
# check with git diff
find . | grep '\.bak$' | xargs rm

Install https://github.com/erniebrodeur/ruby-beautify

View performance_test_helper.rb
# See http://m.onkey.org/running-rails-performance-tests-on-real-data
# fixed to work with Rails 3.2.15
# START : HAX HAX HAX
# Load Rails environment in 'test' mode
ENV["RAILS_ENV"] ||= "test"
require File.expand_path('../../config/environment', __FILE__)
# Re-establish db connection for 'performance' mode
ActiveRecord::Base.establish_connection(:performance)