Skip to content

Instantly share code, notes, and snippets.

View jeffdeville's full-sized avatar

Jeff Deville jeffdeville

View GitHub Profile
@jeffdeville
jeffdeville / download_airbrake_errors.rb
Created August 19, 2012 19:52
Downloads the last 50 pages of Airbrake errors
# Requires mechanize gem (gem install mechanize)
# To use:
# 1. Update this script w/ your site's login url, email, password, and project_id
# 2. gem install mechanize
# 3. ruby download_airbrake_errors.rb
# 4. Wait... I didn't make this thing even remotely fast or efficient, since I don't need to use it that often.
# 5. It will download each error page to the /cache directory
# 6. Search it using your filesystem's built-in search capabilities. The filenames are the ids of the error, so you can easily go to the real site for all of the related links
@jeffdeville
jeffdeville / interhomeweb deploy fail
Created July 23, 2012 22:03
interhomeweb deploy fail
➜ ey deploy -e Production187 -r master -a interhome_web -v 1 ↵
Loading application data from EY Cloud...
Beginning deploy of ref 'master' for 'interhome_web' in 'Production187' on server...
Running command on [email protected].
Command: bash -lc '(/usr/local/ey_resin/ruby/bin/gem list engineyard-serverside | grep '\''engineyard-serverside '\'' | egrep -q '\''1\.5\.33[,)]'\'') || (sudo sh -c '\''cd `mktemp -d` && /usr/local/ey_resin/ruby/bin/gem install engineyard-serverside --no-rdoc --no-ri -v 1.5.33'\'')'
Successfully installed engineyard-serverside-1.5.33
1 gem installed
Running command on [email protected].
Command: bash -lc '/usr/local/ey_resin/ruby/bin/engineyard-serverside _1.5.33_ deploy --app interhome_web --config '\''{"deployed_by":"Jeff Deville"}'\'' --framework-en
@jeffdeville
jeffdeville / before_migrate.rb
Created July 23, 2012 21:14
before_migration
# Used by EngineYard Cloud after deployment
#
# Work around Engine Yard
if node[:instance_role] == "util"
# Don't use memcache on util boxes.
env_file = "#{release_path}/config/environments/#{node[:environment][:framework_env]}.rb"
run "mv #{env_file} #{env_file}.orig && grep -v DO_NOT_USE_IN_EY_UTIL_INSTANCE #{env_file}.orig > #{env_file}"
else
run "ln -nfs #{shared_path}/config/memcached_custom.yml #{release_path}/config/memcached.yml"
@jeffdeville
jeffdeville / gist:3166225
Created July 23, 2012 21:04
187 deploy failure
ey deploy -e Production187 -r master -a admin -v
Loading application data from EY Cloud...
Beginning deploy of ref 'master' for 'admin' in 'Production187' on server...
Running command on [email protected].
Command: bash -lc '(/usr/local/ey_resin/ruby/bin/gem list engineyard-serverside | grep '\''engineyard-serverside '\'' | egrep -q '\''1\.6\.4[,)]'\'') || (sudo sh -c '\''cd `mktemp -d` && /usr/local/ey_resin/ruby/bin/gem install engineyard-serverside --no-rdoc --no-ri -v 1.6.4'\'')'
Running command on [email protected].
Command: bash -lc '/usr/local/ey_resin/ruby/bin/engineyard-serverside _1.6.4_ deploy --app admin --config '\''{"deployed_by":"Jeff Deville"}'\'' --framework-env production --instance-names ec2-23-22-132-233.compute-1.amazonaws.com:utility_1 --instance-roles ec2-23-22-132-233.compute-1.amazonaws.com:util localhost:app_master --instances ec2-23-22-132-233.compute-1.amazonaws.com localhost --migrate '\''rake db:migrate'\'' --ref f47b6
@jeffdeville
jeffdeville / gist:3165443
Created July 23, 2012 19:01
backtrace from airbrake
[GEM_ROOT]/gems/mysql2-0.2.18/lib/active_record/connection_adapters/mysql2_adapter.rb:265:in `query'
[GEM_ROOT]/gems/mysql2-0.2.18/lib/active_record/connection_adapters/mysql2_adapter.rb:265:in `execute'
[GEM_ROOT]/gems/activerecord-3.0.12/lib/active_record/connection_adapters/abstract_adapter.rb:202:in `log_without_newrelic_instrumentation'
[GEM_ROOT]/gems/activesupport-3.0.12/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
[GEM_ROOT]/gems/activerecord-3.0.12/lib/active_record/connection_adapters/abstract_adapter.rb:200:in `log_without_newrelic_instrumentation'
[GEM_ROOT]/gems/newrelic_rpm-3.3.4.1/lib/new_relic/agent/instrumentation/active_record.rb:31:in `log'
[GEM_ROOT]/gems/newrelic_rpm-3.3.4.1/lib/new_relic/agent/method_tracer.rb:242:in `trace_execution_scoped'
[GEM_ROOT]/gems/newrelic_rpm-3.3.4.1/lib/new_relic/agent/instrumentation/active_record.rb:28:in `log'
[GEM_ROOT]/gems/mysql2-0.2.18/lib/active_record/connection_adapters/mysql2_adapter.rb:265:in `execute'
[GEM_ROOT]/gems/mysql2
@jeffdeville
jeffdeville / gist:3165347
Created July 23, 2012 18:44
deploy failure - prod
➜ deploy_prod 1 ↵
Loading application data from EY Cloud...
Beginning deploy of ref 'master' for 'admin' in 'production' on server...
Running command on [email protected].
Command: bash -lc '(/usr/local/ey_resin/ruby/bin/gem list engineyard-serverside | grep '\''engineyard-serverside '\'' | egrep -q '\''1\.6\.4[,)]'\'') || (sudo sh -c '\''cd `mktemp -d` && /usr/local/ey_resin/ruby/bin/gem install engineyard-serverside --no-rdoc --no-ri -v 1.6.4'\'')'
Running command on [email protected].
Command: bash -lc '/usr/local/ey_resin/ruby/bin/engineyard-serverside _1.6.4_ deploy --app admin --config '\''{"bundle_without":"development test test_rspec","migration_command":"rake db:migrate --trace","copy_exclude":[".git"],"deployed_by":"Jeff D
@jeffdeville
jeffdeville / suspend_ih_props_with_no_location.rb
Created April 25, 2012 15:09
Suspend properties with no geocoordinates, and tag them w/ the mixin no_location
mixin = InventoryMixin.find(776)
Inventory.not_geocoded.where(:property_management_company_id => 154).each do |inv|
inv.mixins << mixin
inv.status = "suspended"
inv.save!
end
/** If user is not loggeding **/
move2picasa.loggedout=function(xhr, textstatus){
move2picasa.$('#details').hide()
move2picasa.$('#message').show()
if(xhr.status==0){
move2picasa.showMessage('Looks like you have aborted an ongoing request. Please refresh to continue.', true)
}else{
if(xhr.responseText == 'Authorization required'){
move2picasa.$('#message').html('Please login into <a target="_blank" href="http://picasaweb.google.com">Picasa</a> in another tab and then refresh this tab to use the extension. <br/> Do not logout/login into another account until transfer is complete. Hit "Cancel" and "Upload" again if there are any hiccups.').css('color', 'red')
}
@jeffdeville
jeffdeville / set_locations.js
Created April 4, 2012 12:16
Replacing French Locations
ul = $(".sb_homes_ul")
ul.children().empty()
cities = ["Aigues Mortes", "Aime", "Aix en Provence", "Albon", "Alpe D Huez", "Amboise", "Amiens", "Annemasse", "Antibes", "Apt", "Arcachon", "Arles", "Armbouts Cappel", "Arras", "Aubagne", "Auribeau-sur-Siagne", "Autun", "Auxerre", "Avignon", "Avoriaz", "Bagnolet", "Bayeux", "Bazas", "Beaune", "Bezons", "Biarritz", "Blois", "Bondues", "Bordeaux", "Bougival", "Bourg Saint Maurice", "Brest", "Briancon", "Brides les Bains", "Bron", "Calais", "Calvi", "Cannes", "Carcassonne", "Carry le Rouet", "Chantilly", "Chelles", "Chilly-Mazarin", "Clermont Ferrand", "Clichy", "Colmar", "Coquelles", "Courbevoie", "Deauville", "Dijon", "Dinard", "Divonne-les-Bains", "Epernay", "Equemauville", "Evian Les Bains", "Ferney Voltaire", "Feytiat", "Fontevraud", "Fos-sur-Mer", "Fouesnant", "Fresnes", "Fuveau", "Gap", "Gradignan", "Graveline", "Grenoble", "Grimaud", "Guebwiller", "Guerande", "Hardelot", "Hesdin Labbe", "Isola", "Istres", "Jausiers", "Juan Les Pins", "La Baule", "La Ciotat",
@jeffdeville
jeffdeville / create_collage.rb
Created December 12, 2011 16:32
works in irb, not in rails
require 'RMagick'
require 'open-uri'
require 'ap'
image_urls = %w[http://images3.cpcache.com/product_zoom/215803453v6_460x460_Front_Color-Cardinal_padToSquare-true.jpg http://images2.cpcache.com/product_zoom/292564282v8_460x460_Front_Color-MilitaryGreen_padToSquare-true.jpg http://images0.cpcache.com/product_zoom/57297330v27_460x460_Front_Color-Black_padToSquare-true.jpg]
images = (0..2).collect do |index|
begin
blob = open(image_urls[index]).read
image = Magick::Image.from_blob(blob)[0]
image.resize_to_fit 200, 200