Skip to content

Instantly share code, notes, and snippets.

View steder's full-sized avatar
🐧
Being a penguin

Mike Steder steder

🐧
Being a penguin
View GitHub Profile
import time
from boto.ec2.autoscale import AutoScaleConnection
def find_unused_launch_configs():
conn = AutoScaleConnection()
autoscale_groups = conn.get_all_groups(max_records=100)
launch_configs = conn.get_all_launch_configurations(max_records=100)
launch_config_names = {lc.name for lc in launch_configs}
# This is a little slow, so we cache it so we're not running a slow
# find on every terminal startup:
if [[ -e ~/.cache/zsh_exports_gnubin ]]; then
gnubins=(${(ps:\n:)"$(cat ~/.cache/zsh_exports_gnubin)"})
else
gnubins=(${(ps:\n:)"$(find /usr/local/opt -type d -follow -name gnubin -print | tee ~/.cache/zsh_exports_gnubin)"})
fi
for bindir in $gnubins; do
export PATH=$bindir:$PATH;
@steder
steder / pre-commit.py
Created September 13, 2011 15:11
Git Pre-commit Hook For Python now with extra Python!
#!/usr/bin/env python
#-*- mode: python -*-
from subprocess import Popen, PIPE
import sys
syntax_checker = "pyflakes"
def run(command):
p = Popen(command.split(), stdout=PIPE, stderr=PIPE)
@steder
steder / aws_sg_recipe.py
Created December 19, 2011 19:11
Create and update AWS security groups using Python and Boto.
#!/usr/bin/env python
"""
Recipe for creating and updating security groups programmatically.
"""
import collections
import boto
@steder
steder / starcraft.el
Created March 7, 2012 04:17
Starcraft Minor Mode for Emacs
;; -*- coding: utf-8 -*-
;; starcraft.el -- track user APM (actions per minute) while using Emacs
;;
;; Copyright 2010 by Michael Steder
;; Author: Michael Steder (steder@gmail.com)
;; Created: 2010
;; Version: 1.0
;; Keywords: Actions per minute
;;
;; Inspired by a love of Starcraft and someones offhand comment