Skip to content

Instantly share code, notes, and snippets.

@jerm
jerm / jerm-prompt
Created September 19, 2013 20:18
My bash prompt. looks like: http://cl.ly/image/0P2p2g2c3k11 Will tell you the time, your current aws(boto) env, you current path, the results status (as a red top line) of your last command, current user (red if root (root must have this as her prompt), current hostname (red if "prod" appears in the hostname) Requires: you must have .git-complet…
source .git-completion.bash
source .git-prompt.sh
# Jeremy's color and screen and graphical term naming prompt
_boto_env(){
if [ -n "$BOTO_CONFIG" ]; then
echo "aws-${BOTO_CONFIG##*-}"
else
echo -n "aws-default"
fi
}
@jerm
jerm / change_boto.sh
Last active December 26, 2015 04:39
Bash function to easily (re)point boto and awscli to your preferred config files
# @jermops 's boto and aws cli config unifyer/switcher
cb(){
set_default_boto(){
unset BOTO_CONFIG
unset BOTO_DISPLAYENV
export AWS_CONFIG_FILE=~/.boto
echo "Using default .boto"
}
---
- name: Group by Distribution
hosts: all
tasks:
- group_by: key={{ansible_distribution}}
- name: Set Time Zone
hosts: Ubuntu
gather_facts: False
vars:
@jerm
jerm / ms_odbc_ubuntu.patch
Created November 21, 2015 04:10
Patch for making msodbcsql-11.0.2270.0/install.sh work on ubuntu
--- install.sh 2013-01-15 15:11:53.000000000 -0500
+++ install-ubuntu.sh 2015-11-11 09:20:50.000000000 -0500
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Microsoft ODBC Driver 11 for SQL Server Installer
# Copyright Microsoft Corp.
@@ -17,7 +17,7 @@
req_proc="x86_64";
location ~ /down_(50[0-4]) {
return $1;
}
@jerm
jerm / route53_delete_zone.py
Last active January 28, 2016 02:47
1-step route53 zone delete
def delete_zone(domain):
""" Deleting a hosted zone in AWS is a real pain if you have any number of
resource records defined because you must first delete all RR's in order to
remove the zone. This is a one-stop script to do all of that in one command.
"""
import boto
from boto.route53.record import ResourceRecordSets
PROTECTED_DOMAINS = ['foo.com', 'bar.net']
@jerm
jerm / aws_elb_info.py
Created January 26, 2016 07:44
function to return names and/or ips of instances connected to an aws ELB
def get_elb_member_info(load_balancers):
""" Takes an ELB (Elastic Load balancer) name or list of ELB namess and
returns a dict of:
ips: a list containing the private ip address of each instance
names: a list containing the tag_Name of each instancee
"""
import boto
elbs = boto.connect_elb().get_all_load_balancers(load_balancers)
@jerm
jerm / Resources for Community Professionals.md
Last active January 31, 2016 06:23 — forked from mary-grace/Resources for Community Professionals.md
Resources for Community Professionals.md

I co-host The Community Pulse with Jason Hand, and with every episode, we get a fantastic list of resources for community professionals. I've begun this gist as a way to keep track of them all. I'm also pulling some of the resources from CMX Hub and CMGRChat (all notes/reviews pulled from these sites). Please feel free to make a pull request to add any books, blogposts, videos, or organizations you'd like to see represented!

jermops rules

Disclaimer:

For the most part, these are not resources I have read/watched/listened to myself. My apologies in advance if there is anything offensive in them. Please file an issue or reach out to me on Twitter if there is anything you find that is off-color or untoward in any way.

Books

@jerm
jerm / aws_ebs_snaps.py
Last active March 4, 2016 05:40
Easy way to snap all volumes on an instance.
import boto
import datetime
def lookup_instance_by_id(instance_id):
conn = boto.connect_ec2()
try:
instance = conn.get_all_instances(filters = {'instance_id':instance_id})[0].instances[0]
except IndexError:
return False
if instance.state != 'terminated':

Keybase proof

I hereby claim:

  • I am jerm on github.
  • I am jermops (https://keybase.io/jermops) on keybase.
  • I have a public key ASBBbEfmJpMCpL_Nx1V9kTRXmhSR4h3LkJ_yuCiL0_Y0Xwo

To claim this, I am signing this object: