Skip to content

Instantly share code, notes, and snippets.

View apsoto's full-sized avatar

Alex Soto apsoto

  • San Francisco, CA
View GitHub Profile
@apsoto
apsoto / gist:2869888
Created June 4, 2012 18:00
Diagram Showing EC2 Security Group Data Flows
require 'rubygems'
require 'activesupport'
require 'aws'
require 'graphviz'
ec2 = Aws::Ec2.new(ENV["AMAZON_ACCESS_KEY_ID"], ENV["AMAZON_SECRET_ACCESS_KEY"])
g = ec2.describe_security_groups
gv = GraphViz::new( "structs", "type" => "graph" )
@apsoto
apsoto / autossh init.d
Created May 2, 2012 06:06 — forked from atr000/autossh init.d
launches and maintains uniquely named autossh tunnels alive
#! /bin/sh
#
# Author: Andreas Olsson <andreas@arrakis.se>
# Version: @(#)autossh_tunnel.foo 0.1 27-Aug-2008 andreas@arrakis.se
#
# For each tunnel; make a uniquely named copy of this template.
## SETTINGS
#
@apsoto
apsoto / gist:1503758
Created December 20, 2011 23:18 — forked from jtimberman/gist:1040853
Ohai plugin to return semantic reference attributes for network addresses
require 'rubygems'
require 'ohai'
o = Ohai::System.new()
o.all_plugins
# And retrieve some useful semantic reference attributes for network interfaces
o['network']['interfaces'].each do |iface, addrs|
addrs['addresses'].each do |ip, params|
@apsoto
apsoto / gist:1364958
Created November 14, 2011 19:57
template example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Mustache Test</title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script type="text/javascript" src="http://github.com/downloads/wycats/handlebars.js/handlebars.1.0.0.beta.3.js"></script>
<script id="some-template" type="text/x-handlebars-template">
<table>
@apsoto
apsoto / ebs_raid.rb
Created November 11, 2011 05:25 — forked from tnine/ebs_raid.rb
Ebs raid mounting. Links to this jira issue http://tickets.opscode.com/browse/CHEF-2275
include Opscode::Aws::Ec2
#Auto locates and attached ebs devices based on the data bag they reside in. The following test cases need to be performed
# Create multiple resources with new node: PASS
#
# Re-attach multiple resources after a reboot: PASS
#
# Create resources across 2 runs. First run creates first raid set, second run re-attaches then creates: PASS
#
@apsoto
apsoto / links.textile
Created November 5, 2011 02:23 — forked from lucashungaro/links.textile
Links de referência utilizados em minha palestra
@apsoto
apsoto / .autotest
Created October 24, 2011 23:12 — forked from alainravet/.autotest
~/autotest config file
#autotest configuration
#
require 'redgreen/autotest'
require 'autotest/timestamp'
# ####################
# GROWL CONFIG
# ####################
@apsoto
apsoto / rspec-syntax-cheat-sheet.rb
Created October 19, 2011 22:25 — forked from dnagir/rspec-syntax-cheat-sheet.rb
RSpec 2 syntax cheat sheet by example
# RSpec 2.0 syntax Cheet Sheet by http://ApproachE.com
# defining spec within a module will automatically pick Player::MovieList as a 'subject' (see below)
module Player
describe MovieList, "with optional description" do
it "is pending example, so that you can write ones quickly"
it "is already working example that we want to suspend from failing temporarily" do
pending("working on another feature that temporarily breaks this one")
@apsoto
apsoto / chef-ec2.rake
Created September 5, 2011 05:20
Chef EC2 Node Cleanup task
namespace :ec2 do
# setup chef config
#
config = File.join(File.dirname(__FILE__), '..', '.chef', 'knife.rb')
Chef::Config.from_file(config)
load_gem_or_report(%w{aws})
desc 'Delete any ec2-based chef nodes that no longer exist'
task :cleanup_nodes do
@apsoto
apsoto / ebs_raid.rb
Created September 2, 2011 06:34 — forked from tnine/ebs_raid.rb
ebs raid chef code
include Opscode::Aws::Ec2
# Auto locates and attached ebs devices based on the data bag they reside in. The following test cases need to be performed. Currently limited to 15 drives for the raid due to the drive mount point seek iteration logic. This could be fixed to include more than 15 mount points.
# Create multiple resources with new node: PASS
#
# Re-attach multiple resources after a reboot: PASS
#
# Create resources across 2 runs. First run creates first raid set, second run re-attaches then creates: PASS
#