Skip to content

Instantly share code, notes, and snippets.

View colebrumley's full-sized avatar

Cole Brumley colebrumley

  • Saint Louis, MO
View GitHub Profile

Keybase proof

I hereby claim:

  • I am colebrumley on github.
  • I am colebrumley (https://keybase.io/colebrumley) on keybase.
  • I have a public key ASDKwltZfohCUqbpUAV6IC2S8LdjQjvTqQLKEM-IJ0Ys5go

To claim this, I am signing this object:

@colebrumley
colebrumley / admin_shell.ps1
Last active October 24, 2017 18:28
Reinvoke the current PowerShell script as Admin
function Launch-Admin-Shell () {
# Get the ID and security principal of the current user account
$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
$myWindowsPrincipal=new-object System.Security.Principal.WindowsPrincipal($myWindowsID)
# Get the security principal for the Administrator role
$adminRole=[System.Security.Principal.WindowsBuiltInRole]::Administrator
# Check to see if we are currently running "as Administrator"
if ($myWindowsPrincipal.IsInRole($adminRole))
@colebrumley
colebrumley / get_amis_in_use_by_launch_configs.py
Last active October 24, 2017 18:01
Use boto3 to pull a list of AMIs that are in use by Launch Configs that are currently assigned to an auto scaling group. Use this if you are trying to determine if it's safe to delete an AMI
import boto3
def get_amis_in_use_by_launch_configs():
asg_client = boto3.client('autoscaling')
# Pull a list of the active Launch Configs
lc_names = []
paginator = asg_client.get_paginator('describe_auto_scaling_groups')
for page in paginator.paginate():
for asg in page['AutoScalingGroups']:
@colebrumley
colebrumley / pypy.sh
Created January 6, 2017 15:47
PyPy+Makeself standalone installer
#!/bin/bash -ex
# WHAT THIS IS
# This script creates a standalone "installer" for a pip-enabled Python package
# using Makeself. What is different about this script versus native Makeself is
# that each installer includes a dedicated Python installation (using PyPy) and
# wrapper scripts to make invocation transparent. Python is not required on the
# host, and changes to the host's Python installation will not affect apps
# installed using this script.
#!/bin/bash
set -xe
cd $HOME
# Remove the build cache and get Glide
rm -Rf $GOPATH/src/*
go get github.com/Masterminds/glide
mkdir -p $HOME/.go_workspace/src/github.com/$CIRCLE_PROJECT_USERNAME/
cd $HOME/.go_workspace/src/github.com/$CIRCLE_PROJECT_USERNAME
@colebrumley
colebrumley / convoy
Created December 22, 2015 20:53
Convoy init.d script
#!/bin/sh
set -e
### BEGIN INIT INFO
# Provides: convoy
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Should-Start: cgroupfs-mount cgroup-lite
# Should-Stop: cgroupfs-mount cgroup-lite
# Default-Start: 2 3 4 5
consul:
image: elcolio/consul
restart: always
labels:
io.rancher.os.after: console
io.rancher.os.detach: "false"
io.rancher.os.scope: system
restart: always
net: host
volumes:
@colebrumley
colebrumley / dev_restart.coffee
Created December 11, 2015 18:22
Hubot Coffeescript
module.exports = (robot) ->
rdBaseURL = "https://ops.enteon.io:8443/"
rdUUIDs =
dev_restart: 'd9e1371b-1489-4e10-832e-e244d449e617'
u = rdBaseURL + "api/14/job/"+rdUUIDs.dev_restart+"/run"
enterReplies = ['Bork.', 'Bork bork bork bork bork', 'Bork? Bork?! Youre not looking at the big picture!']
leaveReplies = ['Peace out, bruh!', 'F all this jazz...', 'I, uh, have to go move something from my trunk...']
robot.enter (res) ->
res.send res.random enterReplies
robot.leave (res) ->
@colebrumley
colebrumley / cloud config
Last active August 29, 2015 14:22
user-data.weave.yml
#cloud-config
---
coreos:
etcd:
discovery: https://discovery.etcd.io/559e1af13634ecbb80dfa0a0d04cff9a
addr: $public_ipv4:4001
peer-addr: $public_ipv4:7001
fleet:
public-ip: $public_ipv4