Skip to content

Instantly share code, notes, and snippets.

@kernow
kernow / elb_target.py
Created October 10, 2017 12:08
Ansible elb target group module with working de/register commands
#!/usr/bin/python
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'metadata_version': '1.1'}
DOCUMENTATION = '''
---
# file: staging/main
# ec2.ini and ec2.py live in the same folder
[localhost]
localhost env=staging
@kernow
kernow / using use_rvm_in_readonly branch
Last active December 25, 2015 20:59
rvm mixed mode error on deploy
INFO [64147baa] Running /usr/local/rvm/bin/rvm 1.9.3 --install do bundle --gemfile /home/rubytest/rails_applications/rails-3.2-ruby-1.9/releases/20131021140106/Gemfile --path /home/rubytest/rails_applications/rails-3.2-ruby-1.9/shared/bundle --deployment --quiet --binstubs /home/rubytest/rails_applications/rails-3.2-ruby-1.9/shared/bin --without development test on rubytest.media72.net
DEBUG [64147baa] Command: cd /home/rubytest/rails_applications/rails-3.2-ruby-1.9/releases/20131021140106 && /usr/local/rvm/bin/rvm 1.9.3 --install do bundle --gemfile /home/rubytest/rails_applications/rails-3.2-ruby-1.9/releases/20131021140106/Gemfile --path /home/rubytest/rails_applications/rails-3.2-ruby-1.9/shared/bundle --deployment --quiet --binstubs /home/rubytest/rails_applications/rails-3.2-ruby-1.9/shared/bin --without development test
DEBUG [64147baa] /usr/local/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find bundler (>= 0) amongst [] (Gem::LoadError)
DEBUG [64147baa] from /usr/lo
export rvm_environments_path="${HOME}/.rvm/environments"
export rvm_gems_path="${HOME}/.rvm/gems"
export rvm_gems_cache_path="${HOME}/.rvm/gems_cache"
export rvm_wrappers_path="${HOME}/.rvm/wrappers"
export rvm_create_flag="1"
export rvm_user_path="${HOME}/.rvm/user"
export rvm_log_path="${HOME}/.rvm/log"
config.middleware.insert_after Warden::Manager, Dragonfly::Middleware, :reports
config.middleware.insert_after Rack::Cache, Dragonfly::Middleware, :images
<?xml version="1.0" encoding="UTF-8"?>
<theDavidBox>
<request>
<arg0>check_database</arg0>
<arg1>smb://[foo=bar]GIGANTO/Video</arg1>
<module>metadata_database</module>
</request>
<response>
<database_path>/share/nmj_database_1/media.db</database_path>
</response>
@kernow
kernow / gist:3437765
Created August 23, 2012 15:30
chef-user databag creation
#
# Cookbook Name:: user
# Recipe:: data_bag
#
# Copyright 2011, Fletcher Nichol
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
class CreateUserRememberTokens < ActiveRecord::Migration
def self.up
User.all.each do |u|
u.reset_remember_token!
puts u.reload.remember_token
end
end
end
# create a worldpay response object that acts like a string but has the each_header method
# so that we can access the headers that worldpay returns
class WorldPayResponse < String
def initialize(resp)
@resp = resp
super(resp.body)
end
undefined method `tables' for class `ActiveRecord::ConnectionAdapters::PostgreSQLAdapter' (NameError)
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/activesupport-2.3.8/lib/active_support/core_ext/module/aliasing.rb:33:in `alias_method'
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/activesupport-2.3.8/lib/active_support/core_ext/module/aliasing.rb:33:in `alias_method_chain'
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/rails_sql_views-0.8.0/lib/rails_sql_views/connection_adapters/postgresql_adapter.rb:5:in `included'
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/rails_sql_views-0.8.0/lib/rails_sql_views/loader.rb:12:in `include'
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/rails_sql_views-0.8.0/lib/rails_sql_views/loader.rb:12:in `load_extensions'
/Users/JamieD/.rvm/gems/ree-1.8.7-2010.02@specializein-template/gems/rails_sql_views-0.8.0/lib/rails_sql_views/loader.rb:10:in `class_eval'
/Users/Jami