This file contains hidden or 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
| #use like | |
| #AWS_KEY='asdasd' AWS_SECRET='123123' irb/script | |
| source_file= 'nightly_s3_db.tar-ab' | |
| target_subdir= 'ey-production-db-backups' | |
| file_to_upload = File.basename(source_file) | |
| bucket = 'co-devops' | |
| key= "#{target_subdir}/#{file_to_upload}" | |
| require 'fog' |
This file contains hidden or 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
| # Needed because I also have Gem models that are throwing errors not just my models. I'd like to have one simple mixin or monkey patch. | |
| # without mucking with ActiveRecord::Base too much. | |
| module SortedById | |
| extend ActiveSupport::Concern | |
| included do | |
| default_scope order('id ASC') | |
| end | |
| end | |
| ActiveRecord::Base.send(:include,SortedById) |
This file contains hidden or 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
| # Add to initializer | |
| module SortedById | |
| extend ActiveSupport::Concern | |
| included do | |
| default_scope order('id ASC') | |
| end | |
| end | |
| Rails.application.eager_load! | |
| models = ActiveRecord::Base.subclasses.collect {|ea| ea.name} |
This file contains hidden or 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
| require 'redis' | |
| # cleanup is a breeze! | |
| redis = Redis.new(:host => "localhost", :port => 6379) | |
| resque_junk = redis.keys 'resque*' | |
| resque_junk.each {|ea| redis.del ea} |
This file contains hidden or 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
| AR_ADAPTER=`bundle exec rails runner 'puts "#{ActiveRecord::Base.connection.instance_variable_get(:@config)[:adapter]}"'` |
This file contains hidden or 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
| # uses underscore-cli Node project | |
| # https://github.com/ddopson/underscore-cli | |
| elastic-beanstalk-describe-configuration-settings -a <MY APP> -e <MY ENV> -j | underscore print > app-env-config.json |
This file contains hidden or 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
| def prompt(*args) | |
| print(*args) | |
| STDIN.gets.strip | |
| end | |
| # inspired from somewhere on stackoverflow. if that's all you need, then no need for a whole library. |
This file contains hidden or 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
| grep chef-ey /var/log/enzyme.log |
This file contains hidden or 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
| ps -ef | grep sidek | grep -v grep | cut -c10-14 | grep -v tail| xargs kill -USR1 | |
| # after this you'll need to restart Sidekiq via sidekiqctl or monit,etc |