Skip to content

Instantly share code, notes, and snippets.

View kryptek's full-sized avatar

Alfred Moreno kryptek

  • Amazon Web Services
  • Seattle, WA
View GitHub Profile
@kryptek
kryptek / elb-describe.py
Created December 11, 2013 17:14
Retrieve an EC2 Load Balancers instances and their health status using python
import boto
import sys
ec2 = boto.connect_ec2()
elb = boto.connect_elb()
load_balancer = elb.get_all_load_balancers(load_balancer_names=[sys.argv[1]])[0]
health = load_balancer.get_instance_health()
instances = ec2.get_only_instances(instance_ids=[instance.id for instance in load_balancer.instances])

Creating a dynamic site-to-site VPN with OpenSwan on Ubuntu 10.04 on EC2

Wes Winham [email protected]

There are many tutorials floating around the web that almost get you a dynamic VPN in EC2. The goal of this tutorial is to be a one-stop-shop for this specific setup.

require "cgi"
class AkamaiTokenConfig
attr_accessor :window, :session_id, :data, :salt, :field_delimiter, :early_url_encoding, :ip
attr_reader :start_time, :hash_strategy, :acl, :url
def initialize(config={})
@ip = ''
self.start_time = Time.now.to_i
self.acl = '/*'
@kryptek
kryptek / gist:5460348
Last active December 16, 2015 15:59 — forked from bkimble/gist:1365005
#!/usr/bin/env ruby
require 'net/telnet'
require 'terminal-table'
tbl = Terminal::Table.new headings: %w(id expires cache_key bytes)
localhost = Net::Telnet::new("Host" => "localhost", "Port" => 11211, "Timeout" => 3)
matches = localhost.cmd("String" => "stats items", "Match" => /^END/).scan(/STAT items:(\d+):number (\d+)/)
slabs = matches.inject([]) { |items, item| items << Hash[*['id','items'].zip(item).flatten]; items }