Skip to content

Instantly share code, notes, and snippets.

Justin Clayton justinclayton

  • Seattle
Block or report user

Report or block justinclayton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@justinclayton
justinclayton / gist:3515615
Created Aug 29, 2012
expanded from coffeescript
View gist:3515615
$(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);
View beecat.coffee
module.exports = (robot) ->
robot.hear /bee.?cat+s?\b/i, (message) ->
message.send "http://bit.ly/thebeecat"
@justinclayton
justinclayton / janky.zsh-theme
Last active Dec 21, 2015
My hacked up zsh prompt. Displays info on RVM, git, and battery (on MacBooks). Drop in ~/.oh-my-zsh/custom/themes/ and go
View janky.zsh-theme
## 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: "")}'
}
@justinclayton
justinclayton / delete_orphaned_ebs_os_volumes.sh
Created Dec 14, 2013
The marriage of aws-cli and jq means things like this aren't hard anymore!
View delete_orphaned_ebs_os_volumes.sh
#!/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 / gist:11271590
Created Apr 24, 2014
running puppet resource on a host not managed by puppet
View gist:11271590
$ puppet resource user justin
user { 'justin':
ensure => 'present',
comment => 'Justin Clayton',
gid => '20',
groups => ['_appserveradm', '_appserverusr', '_lpadmin', 'access_bpf', 'admin'],
home => '/Users/justin',
password => '*',
shell => '/bin/zsh',
uid => '501',
@justinclayton
justinclayton / who_is_on_call.rb
Created Jan 20, 2015
Who's On Call In Service Now
View who_is_on_call.rb
#!/usr/bin/env ruby
require 'rest_client'
@username = URI.encode_www_form_component('username')
@password = URI.encode_www_form_component('password')
@host = 'yoursite.service-now.com'
def uri(table = @table)
return URI::HTTPS.build( {
View VPC-NAT.template
{
"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",
@justinclayton
justinclayton / gist:4f600f2c31e91ffcb17b
Created Mar 6, 2015
Delete unattached 8GB EBS volumes
View gist:4f600f2c31e91ffcb17b
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'
View gist:60736d31b5ef28e9d7fc

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

View gist:c75b8ad81ffe13f11362
{
"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/",
You can’t perform that action at this time.