View gist:8964407
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
rvm --ruby-version --create use 2.1.0@swapper_scraper |
View backbone_yeoman.sh
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
brew update | |
brew install node | |
npm install -g yo | |
npm install -g generator-webapp | |
npm install -g generator-backbone | |
#If you are creating the app | |
mkdir appname && cd $_ | |
yo backbone --template-framework=handlebars appname |
View spotlight
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
sudo mdutil -a -i off | |
sudo mdutil -a -i on |
View gist:5494658
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
#CPU | |
# http://www.cyberciti.biz/tips/how-do-i-find-out-linux-cpu-utilization.html | |
sudo apt-get install sysstat | |
mpstat | |
mpstat -P ALL | |
# Memory | |
# http://superuser.com/questions/398862/linux-find-out-what-process-is-using-all-the-ram | |
# Passenger |
View gist:5238440
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
# Backup | |
pg_dump -U db_user -h localhost -xcO db_name | bzip2 - - > db/db_name.sql.bz2 | |
# Restore | |
# Delete database then recreate then | |
bunzip2 -f db/db_name.sql.bz2 | |
psql -U db_user -h localhost db_name < db/db_name.sql |
View gist:2688605
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
# Upgrade RVM | |
rvm get stable | |
# Get latest Ruby | |
rvm install 2.1.0 | |
# Create and use gemset | |
mkdir project | |
cd project | |
rvm --ruby-version --create use 2.1.0@swapper_scraper |
View gist:2419518
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
string.gsub(/\"(\d+)\/(\d+)\/(\d+)\"/, "\"$3-$2-$1\"") |
View capistrano_database_yml.rb
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
# | |
# = Capistrano database.yml task | |
# | |
# Provides a couple of tasks for creating the database.yml | |
# configuration file dynamically when deploy:setup is run. | |
# | |
# Category:: Capistrano | |
# Package:: Database | |
# Author:: Simone Carletti <weppos@weppos.net> | |
# Copyright:: 2007-2010 The Authors |
View delayed_job_monit_capistrano.rb
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
set :monit_app_services, %w(delayed_job) | |
namespace :delayed_job do | |
desc "Restart the delayed_job process" | |
task :restart, :roles => :app do | |
sudo "RAILS_ENV=#{default_stage} #{current_path}/script/delayed_job restart" | |
end | |
end | |
namespace :monit do |
View Log SQL queries from within the console
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
ActiveRecord::Base.logger = Logger.new(STDOUT) | |
ActiveRecord::Base.clear_active_connections! |