Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env bash
usage() {
echo "Usage: `basename $0` <STACK_NAME>"
exit 1
}
[ "$#" -eq 1 ] || usage
stack_name="$1"
@limed
limed / regions.py
Created June 4, 2015 18:12
List ec2 regions
#!/usr/bin/env python
import boto
import boto.ec2
regions = [region.name for region in boto.ec2.regions()]
for region in regions:
print region
@limed
limed / sort-nicely.py
Created July 1, 2015 17:54
Sorts thing nicely in python
#!/usr/bin/python
def sort_nicely(l):
""" Sort the given list in the way that humans expect.
"""
convert = lambda text: int(text) if text.isdigit() else text
alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ]
l.sort( key=alphanum_key )
nubis-builder build --verbose
1436310877: Loading /Users/limed/nubis/nubis-builder/secrets/variables.json
1436310877: Loading /Users/limed/nubis/nubis-jumphost/nubis/builder/project.json
1436310877: Loading /Users/limed/nubis/nubis-jumphost/nubis/builder/provisioners.json
1436310878: Loading builder amazon-ebs-amazon-linux from /Users/limed/nubis/nubis-builder/packer/builders
1436310878: Running generate-source-ami-ids --source-project-name nubis-base --build-file /tmp/nubis-builder.json.dpPH8AtG --output-file /tmp/source_ami_ids.json.5ILFpagf
nubis-jumphost: Builder aws_amazon_linux_ebs is using nubis-base 1.44 ebs amazon-linux (ami-49c4c279)
1436310881: Loading /tmp/source_ami_ids.json.5ILFpagf
1436310881: Looking for /Users/limed/nubis/nubis-jumphost/nubis/puppet/files
1436310881: Looking for /Users/limed/nubis/nubis-jumphost/nubis/puppet/files
diff --git a/nubis/terraform/inputs.tf b/nubis/terraform/inputs.tf
index a8faa09..0ff00df 100644
--- a/nubis/terraform/inputs.tf
+++ b/nubis/terraform/inputs.tf
@@ -95,6 +95,6 @@ variable "manage_iam" {
description = "IAM roles should be managed in which region"
default = {
us-east-1 = "1"
- us-west-2 = "0"
+ us-west-2 = "1"
# confd -onetime -log-level=debug
2015-08-21T16:23:31Z okta.limed-okta.sandbox.us-west-2.nubis.allizom.org confd[22009]: INFO Backend set to consul
2015-08-21T16:23:31Z okta.limed-okta.sandbox.us-west-2.nubis.allizom.org confd[22009]: INFO Starting confd
2015-08-21T16:23:31Z okta.limed-okta.sandbox.us-west-2.nubis.allizom.org confd[22009]: INFO Backend nodes set to localhost:8500
2015-08-21T16:23:31Z okta.limed-okta.sandbox.us-west-2.nubis.allizom.org confd[22009]: DEBUG Loading template resources from confdir /etc/confd
2015-08-21T16:23:31Z okta.limed-okta.sandbox.us-west-2.nubis.allizom.org confd[22009]: DEBUG Loading template resource from /etc/confd/conf.d/datadog.toml
2015-08-21T16:23:31Z okta.limed-okta.sandbox.us-west-2.nubis.allizom.org confd[22009]: DEBUG Loading template resource from /etc/confd/conf.d/mig-agent-cert.toml
2015-08-21T16:23:31Z okta.limed-okta.sandbox.us-west-2.nubis.allizom.org confd[22009]: DEBUG Loading template resource from /etc/confd/conf.d/mig-agent-key.toml
2015-08-21T16:23:31
@limed
limed / node-notes.md
Last active August 26, 2015 16:38
How to setup a dev node lambda instance
Notes
  • Make sure you have npm installed

  • Install node-lambda

    $ npm install -g node-lambda
  • Create a directory somewhere in your home directory or wherever you want to put your

@limed
limed / index.js
Last active August 26, 2015 17:58
Dumps out pyhsical resource ID of the stack
/**
* A simple Lambda function that takes an AWS CloudFormation stack name
* and returns the physical resouce ID
**/
exports.handler = function(event, context) {
console.log("REQUEST RECEIVED:\n", JSON.stringify(event));
if (event.RequestType == "Delete") {
@limed
limed / iam-mfa.json
Last active September 3, 2015 23:05
Iam policy to enforce MFA
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"*"
],
"Resource": [
"*"
@limed
limed / keys.sh
Last active September 3, 2015 16:33
Searches ldap for ssh key using mail attribute and spits them out
#!/bin/bash
# Search ldap for ssh keys and spits them out
if [[ $# -lt 1 ]]; then
echo "This script will query ldap for an ssh key"
echo "Usage: $0 <ldap email>"
exit 1
fi
# Gets ldap password from gpg file