Skip to content

Instantly share code, notes, and snippets.

View solarce's full-sized avatar

Brandon Burton solarce

View GitHub Profile
@solarce
solarce / kafka_zk.rb
Created October 31, 2014 19:34
example of using chef-search to populate zookeeper IPs for kafka
zookeeper_service_name = "lookout-zk"
zk_ips = []
log("no OVERRIDE found for zookeeper ips, autodiscovering.")
search(:node, "name:#{zookeeper_service_name}-#{mytag}-*").each do |n|
zk_ips << "#{n[:ipaddress]}:2181"
end
log("ZOOKEEPER IPS: #{zk_ips.inspect}")
node.override[:kafka][:broker][:zookeeper][:connect] = zk_ips.join(",")
@solarce
solarce / terraform_apply.rb
Created October 29, 2014 19:54
example of ruby code to help drive terraform apply
#!/usr/bin/ruby
# terraform/lib/terraform.rb
require_relative 'aws'
$terraform_dir = "/opt/terraform"
$terraform_templates = "/opt/terraform_templates"
$terraform_bin = "#{$terraform_dir}/terraform"
def set_terraform_variables(network_zone, instance_name, cluster_name)
@solarce
solarce / SpaceCadet.solarce.tmTheme
Last active August 29, 2015 14:07
Customized copy of SpaceCadet.tmTheme, aka SpaceCade.solarce.tmTheme. I use it with sublimetext2. Included a custom color for "string source.ruby.embedded.source" which is what matches interpolated strings in Ruby code
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>author</key>
<string>Alex Ross</string>
<key>comment</key>
<string>Created by Alex Ross</string>
<key>name</key>
<string>SpaceCadet</string>
@solarce
solarce / ruby_custom_string_interpol.plist
Created October 21, 2014 01:07
Add this to a .tmTheme, e.g. SpaceCadet.tmTheme to get custom highlighting for interpolated strings in ruby source code
<dict>
<key>name</key>
<string>Embedded Ruby Source</string>
<key>scope</key>
<string>string source.ruby.embedded.source</string>
<key>settings</key>
<dict>
<key>foreground</key>
<string>#D01F1E</string>
</dict>
# The various ${var.foo} come from variables.tf
# Specify the provider and access details
provider "aws" {
region = "${var.aws_region}"
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
}
@solarce
solarce / terraform_ec2_clash_2014-10-19-1725.log
Last active August 29, 2015 14:07
terraform_ec2_clash_2014-10-19-1725.log -- crash from trying to use user_data with a map
2014/10/20 00:23:52 Detected home directory from env var: /root
2014/10/20 00:23:52 [DEBUG] Discoverd plugin: aws = /opt/terraform/terraform-provider-aws
2014/10/20 00:23:52 [DEBUG] Discoverd plugin: cloudflare = /opt/terraform/terraform-provider-cloudflare
2014/10/20 00:23:52 [DEBUG] Discoverd plugin: consul = /opt/terraform/terraform-provider-consul
2014/10/20 00:23:52 [DEBUG] Discoverd plugin: digitalocean = /opt/terraform/terraform-provider-digitalocean
2014/10/20 00:23:52 [DEBUG] Discoverd plugin: dnsimple = /opt/terraform/terraform-provider-dnsimple
2014/10/20 00:23:52 [DEBUG] Discoverd plugin: google = /opt/terraform/terraform-provider-google
2014/10/20 00:23:52 [DEBUG] Discoverd plugin: heroku = /opt/terraform/terraform-provider-heroku
2014/10/20 00:23:52 [DEBUG] Discoverd plugin: mailgun = /opt/terraform/terraform-provider-mailgun
2014/10/20 00:23:52 [DEBUG] Discoverd plugin: null = /opt/terraform/terraform-provider-null
@solarce
solarce / ec2.tf
Last active February 4, 2022 04:04
terraform.io example template for ec2 instance with tags
# The various ${var.foo} come from variables.tf
# Specify the provider and access details
provider "aws" {
region = "${var.aws_region}"
access_key = "${var.aws_access_key}"
secret_key = "${var.aws_secret_key}"
}
@solarce
solarce / kitchen.ec2.log
Created September 3, 2014 14:18
zk-wrapper converge failure
[7:02:58]  bburton@althalus  ~/code/lookout/cookbooks/zk-wrapper  kitchen converge
-----> Starting Kitchen (v1.2.1)
-----> Creating <default-ubuntu-1204>...
EC2 instance <i-bf0b2bb4> created.
.......................... (server ready)
Waiting for 10.32.1.143:22...
Waiting for 10.32.1.143:22...
(ssh ready)\n
Finished creating <default-ubuntu-1204> (0m48.38s).
-----> Converging <default-ubuntu-1204>...
"provisioners": [
{
"type": "shell",
"script": "{{user `path_to_script`}}"
}]
@solarce
solarce / sad.sh
Last active August 29, 2015 14:01
i haz a ruby sad. I've got ruby-1.9.3-p545 installed rvm because that's what our chef-repo is pinned to right now, I've got chef and various things installed via bundler, if I installed a knife plugin, the binstub doesn't see it but the knife binary does
[~/code/lookout/chef-repo]$ ruby -v *[master][ruby-1.9.3-p545@global]
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-darwin13.1.0]
[~/code/lookout/chef-repo]$ which ruby *[master][ruby-1.9.3-p545@global]
/Users/bburton/.rvm/rubies/ruby-1.9.3-p545/bin/ruby
[~/code/lookout/chef-repo]$ gem -v *[master][ruby-1.9.3-p545@global]
w2.2.2
h% [~/code/lookout/chef-repo]$ which gem *[master][ruby-1.9.3-p545@global]