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
#!/usr/bin/env python | |
# Registers all instance IPs as weighted records on route53 ( and deletes the ones that aren't part of the ASG anymore ) | |
# Example 1: will create/update/delete records for the "myservice.example.com" with currently registered ASG instances | |
# ./update_route53.py from_asg "my-asg" "myservice" "example.com" | |
# Example 2: will create/update/delete records to match the specified list of ips | |
# ./update_route53.py sync_records my-asg myservice example.com -i 200.200.200.201 200.200.200.202 | |
import argh | |
import boto | |
import boto.route53 |
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
function retry-ssh() { | |
ssh $@ | |
while [ $? -ne 0 ]; do | |
sleep 3; | |
ssh $@; | |
done | |
} | |
function ansiblify() { | |
echo $1 | tr '.-' '_' |
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
--- | |
- hosts: localhost | |
connection: local | |
gather_facts: no | |
tasks: | |
- name: "Create project VPC" | |
ec2_vpc: | |
state: present | |
region: "{{ project_region }}" |
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
util = require 'util' | |
init_aws = () -> | |
aws = require 'aws-sdk' | |
return aws | |
module.exports = (robot) -> | |
robot.respond /ec2 get-instance (.*)$/i, (msg) -> | |
ins_id = msg.match[1].trim() | |
if ins_id.match /i-.*/ |
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
--- | |
- hosts: localhost | |
connection: local | |
vars: | |
all_networks: | |
- 10.80.128.0/20 | |
- 10.80.144.0/20 | |
- 10.80.208.0/20 | |
- 10.10.5.0/24 |
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
#!/usr/bin/env python | |
#quick and dirty script to find any untagged and detached volumes, | |
#take a snapshot and delete it. | |
import json | |
import boto3 | |
def get_detached_untagged_volumes(ec2_conn): | |
volumes = ec2_conn.describe_volumes() | |
return [ volume['VolumeId'] for volume in volumes['Volumes'] | |
if (len(volume['Attachments'])==0 and |
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
# Receives a list of dicts and merges all | |
# sub-dicts into one | |
def flatten_list(l): | |
result = {} | |
for item in l: | |
result.update(item) | |
return result | |
class FilterModule(object): |
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
#!/usr/bin/env python | |
""" | |
Prerequisites: | |
- keyring ( optional ) | |
- argh | |
- beautifulsoup4 | |
- requests-ntlm | |
This scripts authenticates you to your SAML provider and writes the |
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
#!/usr/bin/env python | |
import sys | |
import gobject | |
import gtk | |
import webkit | |
from itertools import cycle | |
class WebBrowser(gtk.Window): |