Skip to content

Instantly share code, notes, and snippets.

@zircote
zircote / run_dynamodb_local.sh
Created February 8, 2015 02:06
A quick run script to get a AWS DynamoDB Local instance going
#!/bin/sh
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
RUN_DIR=${DIR}/.dynamodb
DYNAMODB_LOCAL="http://dynamodb-local.s3-website-us-west-2.amazonaws.com/dynamodb_local_latest.tar.gz"
PORT=8000
ARGS="-inMemory -port ${PORT}"
install_dynamo_db(){
mkdir -p $1
curl -L $2 | tar xvz -C $1

Mac from scratch

Install Software

Install from App Store

Install from Third-Party Websites

@zircote
zircote / docker-regsitry-migrate.py
Created September 8, 2014 19:09
Quick hack to setup the database for docker-registry thats not a sqlite bla blah
import sqlalchemy
import sqlalchemy.exc
import sqlalchemy.ext.declarative
import sqlalchemy.orm
import sqlalchemy.sql.functions
from sqlalchemy import create_engine
engine = create_engine('postgresql://user:pass@my.host.post/db_name')
Base = sqlalchemy.ext.declarative.declarative_base(bind=engine)
@zircote
zircote / cloudera-cdh5.repo
Created August 8, 2014 16:16
CLoudera yum.repo
[cloudera-cdh5]
name=Cloudera's Distribution for Hadoop, Version 5
gpgcheck=1
gpgkey=http://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/RPM-GPG-KEY-cloudera
baseurl=http://archive.cloudera.com/cdh5/redhat/6/x86_64/cdh/5/
humanname=Cloudera's Distribution for Hadoop, Version 5
#http://mirror.centos.org/centos/$releasever/os/$basearch/
@zircote
zircote / nginx-marathon.py
Last active November 12, 2015 19:01
Marathon Config writer for NGINX
from jinja2 import Template
import json
import httplib2
import argparse
TEMPLATE = """
user www-data;
worker_processes 4;
pid /run/nginx.pid;
daemon off;
from boto import route53
r53 = route53.connect_to_region(region_name='us-east-1')
dev_aws = r53.get_zone('my-domain.local')
with open('hosts') as host:
i = 0
rrs = route53.record.ResourceRecordSets(r53, dev_aws.id)
for line in host.readlines():
@zircote
zircote / attribute-resolver.xml
Created July 3, 2014 06:28
Multiple Account support for AWS Federation and Shibboleth
<resolver:AttributeDefinition id="transientId" xsi:type="ad:TransientId">
<resolver:AttributeEncoder xsi:type="enc:SAML1StringNameIdentifier"
nameFormat="urn:mace:shibboleth:1.0:nameIdentifier"/>
<resolver:AttributeEncoder xsi:type="enc:SAML2StringNameID"
nameFormat="urn:oasis:names:tc:SAML:2.0:nameid-format:transient"/>
</resolver:AttributeDefinition>
<resolver:AttributeDefinition id="awsRoles" xsi:type="ad:Mapped" sourceAttributeID="memberOf">
<resolver:Dependency ref="myLDAP"/>
<resolver:AttributeEncoder
@zircote
zircote / ec2.py
Last active May 15, 2018 06:48
fixed yo shit
#!/usr/bin/env python
'''
EC2 external inventory script
=================================
Generates inventory that Ansible can understand by making API request to
AWS EC2 using the Boto library.
NOTE: This script assumes Ansible is being executed where the environment
@zircote
zircote / aws_eventhandler.py
Last active August 29, 2015 14:02
Receive AWS/Notifications and fire an event into Salt Stack
from flask import Flask
from flask import request
import os
import logging
import json
log = logging.getLogger(__name__)
app = Flask(__name__)
AWS_CREDENTIALS = {
'access_key': None,