Skip to content

Instantly share code, notes, and snippets.

View justinclayton's full-sized avatar

Justin Clayton justinclayton

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Alpha Component</key>
<real>1</real>
<key>Blue Component</key>
<real>0.20784313976764679</real>
@justinclayton
justinclayton / asg_to_ips.sh
Created August 29, 2017 23:30
Get private IPs of instances in an AWS autoscaling group
asg_to_ips() {
local asg=$1
local instances=$(aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names ${asg} \
| jq '[.AutoScalingGroups[].Instances[].InstanceId]')
aws ec2 describe-instances --instance-ids ${instances} | jq -r '.Reservations[].Instances[].PrivateIpAddress'
}
@justinclayton
justinclayton / delete_orphaned_ebs_os_volumes.sh
Created December 14, 2013 00:32
The marriage of aws-cli and jq means things like this aren't hard anymore!
#!/bin/bash
aws ec2 describe-volumes \
| jq '.Volumes[] \
| select((.State == "available") and (.Size == 8)) \
| .VolumeId' \
| xargs -n 1 aws ec2 delete-volume --volume-id
@justinclayton
justinclayton / janky.zsh-theme
Last active December 21, 2015 13:38
My hacked up zsh prompt. Displays info on RVM, git, and battery (on MacBooks). Drop in ~/.oh-my-zsh/custom/themes/ and go
## janky theme
#
# based on https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/blinks.zsh-theme
# certain things cribbed from https://github.com/robbyrussell/oh-my-zsh/blob/master/themes/agnoster.zsh-theme
function _battery_capacity {
ioreg -n AppleSmartBattery -r | \
awk '$1~/Capacity/{c[$1]=$3} END{OFMT="%.2f%%"; max=c["\"MaxCapacity\""]; print (max>0? 100*c["\"CurrentCapacity\""]/max: "")}'
}
module.exports = (robot) ->
robot.hear /bee.?cat+s?\b/i, (message) ->
message.send "http://bit.ly/thebeecat"
@justinclayton
justinclayton / gist:3515615
Created August 29, 2012 16:59
expanded from coffeescript
$(document).ready(function() {
var search_box;
search_box = $('#search');
return search_box.bind('keyup', function() {
var items;
items = $('.item_link');
return items.each(function() {
var item, query;
query = $('#search').val();
item = $(this);
{
"Metadata": {
"DcosImageCommit": "fb58e5c0a02fe44e8df2baf92de72bea3030f34b",
"TemplateGenerationDate": "2015-06-05 23:02:57.870011"
},
"Description": "Launching the Mesosphere DCOS cluster",
"Parameters": {
"AcceptEULA": {
"Type": "String",
"Description": "Please read and agree to our EULA: https://docs.mesosphere.com/community-edition-eula/",

Puppet2Chef Terms and Conventions Translator:

Company/Product Terms

  • Puppetlabs -> Chef
  • Reductive Labs -> Opscode
  • Puppet Master -> Chef Server
  • Puppet Agent -> Chef Client
  • Forge -> Supermarket

On the CLI

@justinclayton
justinclayton / gist:4f600f2c31e91ffcb17b
Created March 6, 2015 19:50
Delete unattached 8GB EBS volumes
aws ec2 describe-volumes | jq -r '.Volumes[] | select((.State == "available") and (.Size == 8)) | .VolumeId' | xargs -n 1 aws ec2 delete-volume --volume-id | jq -r '.return'
{
"AWSTemplateFormatVersion" : "2010-09-09",
"Description" : "CloudFormation template for a generic VPC with public and private subnets (with private network Internet access via NAT)",
"Parameters" : {
"KeyPairName" : {
"Description" : "Name of an existing EC2 KeyPair (find or create here: https://console.aws.amazon.com/ec2/v2/home#KeyPairs: )",
"Type" : "String",