Skip to content

Instantly share code, notes, and snippets.

View brandongalbraith's full-sized avatar

B brandongalbraith

  • North America
View GitHub Profile
#!/usr/bin/env python
import gevent.monkey
gevent.monkey.patch_all()
import boto
import config
import gevent
import gevent.pool
import os
In [1]: policy = """{
...: "Statement":[{
...: "Effect":"Allow",
...: "Action":["s3:*"],
...: "Resource":["arn:aws:s3:::mybucket"]}]}"""
In [2]: import boto
In [4]: c = boto.connect_iam()
In [5]: instance_profile = c.create_instance_profile('myinstanceprofile')
In [6]: role = c.create_role('myrole')
In [7]: c.add_role_to_instance_profile('myinstanceprofile', 'myrole')
#!/usr/bin/env python
"""
Recipe for creating and updating security groups programmatically.
"""
import collections
import boto
"""
The MIT License (MIT)
Copyright (c) 2011 Numan Sachwani
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
"""
Requeriments:
$ sudo pip install boto dnspython
Edit ~/.boto to use your AWS credentials
"""
import time
import sys
from boto.route53.connection import Route53Connection
# your amazon keys
key = ""
access = ""
if __name__ == '__main__':
zones = {}
route53 = Route53Connection(key, access)
var _log = console.log;
window.console.log = function(log){
_log.call(console, log.reverse ? log.reverse() : typeof log === 'string' ? log.split('').reverse().join('') : typeof log === 'number' ? log.toString().split('').reverse().join('') : log);
};
@brandongalbraith
brandongalbraith / awsSecConfig.py
Created May 5, 2014 18:26
AWS Security Policy Report (Author: Greg Roth)
#! /usr/bin/python
# Example code to output account security config
__author__ = 'Greg Roth'
import boto
import urllib
import hashlib
import argparse
#!/usr/bin/env sh
# Download lists, unpack and filter, write to stdout
curl -s https://www.iblocklist.com/lists.php \
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \
| xargs wget -O - \
| gunzip \
| egrep -v '^#'
1 import urllib2
2 import json
221 def basic_authorization(user, password):
222 s = user + ":" + password
223 return "Basic " + s.encode("base64").rstrip()
224
225 def submit_pull_request(user, repo):
226 auth = (settings.username, settings.password)
227 url = 'https://api.github.com/repos/' + user + '/' + repo + '/pulls'