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
@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
@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 / 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)
# 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;
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}
@steder
steder / gofind.sh
Created September 9, 2017 02:03
Quickly jump to $GOPATH/src directory
#!/usr/bin/env bash
GOPATH=~/go/src
# Just include this function in your ~/.bashrc
function gof {
if (( $# == 0 )); then
echo "usage: $gof <dir>"
echo "jumps to $GOPATH/src directory matching <dir>"
return
require 'rubygems'
require 'nokogiri'
require 'fileutils'
require 'date'
require 'uri'
# usage: ruby import.rb my-blog.xml
# my-blog.xml is a file from Settings -> Basic -> Export in blogger.
data = File.read ARGV[0]
@steder
steder / sorted.py
Created January 21, 2012 21:05
Words Blog Post Snippets
import itertools
class Dictionary(object):
def __init__(self):
self.words = {}
def insert(self, word):
letters = "".join(sorted(word))
if letters not in self.words:
self.words[letters] = [word]
@steder
steder / pre-commit
Created November 17, 2011 15:57 — forked from spulec/pre-commit
Yipit Pre-commit Hook
#!/usr/bin/env python
import os
import re
import subprocess
import sys
modified = re.compile('^(?:M|A)(\s+)(?P<name>.*)')
CHECKS = [
@steder
steder / nosy.py
Created September 15, 2011 22:39
nosy - my commandline continuous integration tool from the Textura days
#!/usr/bin/env python
# nosy: commandline continuous integration for test driven development
#
# Copyright (C) 2008 Michael Steder <steder@gmail.com>
#
# 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