Skip to content

Instantly share code, notes, and snippets.

@localytics-gist
localytics-gist / humidifier-example.json
Last active June 17, 2016 21:30
Humidifier example.json
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "Example stack",
"Parameters": {
"Env": {
"Type": "String",
"Description": "The deploy environment"
}
},
"Resources": {
@localytics-gist
localytics-gist / humidifier-example.rb
Created June 17, 2016 21:30
Humidifier example.rb
stack = Humidifier::Stack.new(aws_template_format_version: '2010-09-09', name: 'example-stack', description: 'Example stack')
stack.add_parameter('Env', description: 'The deploy environment', type: 'String')
stack.add('LoadBalancer', Humidifier::ElasticLoadBalancing::LoadBalancer.new(
scheme: 'internet-facing',
listeners: [{ LoadBalancerPort: 80, Protocol: 'http', InstancePort: 80, InstanceProtocol: 'http' }],
availability_zones: ['us-east-1a']
))
stack.add('AutoScalingGroup', Humidifier::AutoScaling::AutoScalingGroup.new(
require ‘thor’
require ‘thor/hollaback’
module MyProgram
class Error < StandardError
end
class CLI
class_option :debug, desc: 'Sets up debug mode', aliases: ['-d'], type: :boolean
class_around :safe_execute
CHANGES=$(git --no-pager diff --name-only FETCH_HEAD $(git merge-base FETCH_HEAD master))
[ -n "$(grep '^rails' <<< "$CHANGES")" ] && testRails
script:
- bundle exec rake
- bundle exec rubocop
# Ensure we have loaded the adapter
require 'odbc_adapter'
# Individual ActiveRecord (and ODBC) adapters get required when they are referenced,
# so we need to explicitly require the PostgreSQL adapter here so we can subclass it
require 'odbc_adapter/adapters/postgresql_odbc_adapter'
# Register a dynamically-defined adapter that will subclass the PostgreSQL adapter,
# and tell ODBCAdapter to use it when the connected-to DBMS reports back a name
# matching the given pattern (in this case vertica).
@localytics-gist
localytics-gist / backup.rb
Created June 3, 2017 16:02
Cogito backup
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'cogito', '0.2.0'
gem 'aws-sdk', '~> 2.9'
gem 'rubyzip', '>= 1.0.0'
end
@localytics-gist
localytics-gist / odbc.rb
Last active June 9, 2017 13:38
Snowflake odbc_adapter support
require 'active_record/connection_adapters/odbc_adapter'
require 'odbc_adapter/adapters/postgresql_odbc_adapter'
ODBCAdapter.register(/snowflake/, ODBCAdapter::Adapters::PostgreSQLODBCAdapter) do
# Explicitly turning off prepared statements as they are not yet working with
# snowflake + the ODBC ActiveRecord adapter
def prepared_statements
false
end
@localytics-gist
localytics-gist / Makefile
Last active June 8, 2017 21:23
Select users using ODBC
run: odbc
./odbc $(DSN)
odbc:
gcc -lodbc odbc.c -o odbc
@localytics-gist
localytics-gist / odbc.rb
Last active June 9, 2017 13:47
Sandbox for connecting to ODBC
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile(true) do
source 'https://rubygems.org'
gem 'activerecord', '5.0.3'
gem 'odbc_adapter', '5.0.3'
end
require 'active_record'