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 "json" | |
| require "terminal-table" | |
| fly_app = ARGV[0] | |
| if fly_app.nil? | |
| warn "Usage: check.rb [fly app name]" | |
| exit 1 | |
| end | |
| Machine = Struct.new(:config) do |
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
| Rails.application.configure do | |
| # Don't write output to test.log | |
| config.logger = ::ActiveSupport::Logger.new("/dev/null") | |
| config.logger.formatter = lambda { |*_| nil } | |
| config.logger.level = 10 # FATAL is 4 | |
| end |
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 'rubygems' | |
| gem 'gaffneyc-bunny' | |
| require 'bunny' | |
| # Example of simple RPC using server named queues | |
| Bunny.open do |amqp| | |
| # Exchange definition | |
| amqp.exchange('reply', :type => :direct) | |
| amqp.exchange('out', :type => :direct) |
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
| # | |
| # Cookbook Name:: yumrepo | |
| # Definition:: yumrepo | |
| # | |
| # Copyright 2010, Tippr Inc. | |
| # | |
| # 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 | |
| # |
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
| RECEIPT_FILE=/var/db/receipts/com.apple.pkg.CLTools_Executables.bom | |
| RECEIPT_PLIST=/var/db/receipts/com.apple.pkg.CLTools_Executables.plist | |
| if [ ! -f "$RECEIPT_FILE" ] | |
| then | |
| echo "Command Line Tools not installed." | |
| exit 1 | |
| fi | |
| echo "Command Line Tools installed, removing ..." |
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
| Vagrant::Config.run("2") do |config| | |
| # Clean up the default image to remove some default puppet, chef, and ruby. | |
| config.vm.provision :shell do |shell| | |
| shell.inline = <<-EOF.gsub(/^ +/, "") | |
| # Make sure vagrant always has sudo access | |
| ( cat << 'EOP' | |
| Defaults exempt_group=vagrant | |
| %vagrant ALL=NOPASSWD:ALL | |
| EOP | |
| ) > /etc/sudoers.d/vagrant |
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
| # SomeClass.new("arg1", "arg2").call | |
| class SomeClass < Struct.new(:arg1, :arg2) | |
| def call | |
| @arg1 + @arg2 | |
| end | |
| end | |
| # vs | |
| # SomeClass.new.some_method(arg1, arg2) |
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
| VCR.configure do |c| | |
| # Match the content of urlencoded forms instead of their encoded version. | |
| # This is to address issues with different ordering of the same information. | |
| c.register_request_matcher :form do |actual, match| | |
| content_type = actual.headers["Content-Type"] | |
| # Only valid for forms | |
| if content_type.include?("application/x-www-form-urlencoded") | |
| actual_form = Rack::Utils.parse_nested_query(actual.body) | |
| match_form = Rack::Utils.parse_nested_query(match.body) |
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 "open3" | |
| class TarApp | |
| def call(env) | |
| data = nil | |
| status = nil | |
| if(env["REQUEST_PATH"] !~ /(tgz|tar\.gz)/) | |
| return [ 301, { "Location" => "/current.tgz" }, "" ] | |
| end |
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
| ActiveSupport::Notifications.subscribe("sql.active_record") do |name, start, finish, id, payload| | |
| if payload[:sql] =~ /^\s*(SELECT|DELETE|INSERT|UPDATE) / | |
| method = $1.downcase | |
| table = nil | |
| # Determine the table name for instrumentation. The below regexes work on | |
| # mysql but not sqlite. Probably won't work on postgresql either. | |
| case method | |
| when "select", "delete" | |
| table = $1 if payload[:sql] =~ / FROM `(\w+)`/ |
NewerOlder