Skip to content

Instantly share code, notes, and snippets.

View jspiewak's full-sized avatar

Joshua Spiewak jspiewak

  • Posit
  • Boston, MA
View GitHub Profile
@jspiewak
jspiewak / proof.md
Created January 10, 2019 17:16
keybase proof

Keybase proof

I hereby claim:

  • I am jspiewak on github.
  • I am jspiewak (https://keybase.io/jspiewak) on keybase.
  • I have a public key ASC7e60AeN5dM_u7Uf37VbHuQfzmPwZovmbf8nlWwzw_9go

To claim this, I am signing this object:

@jspiewak
jspiewak / tagsnapshotsfromvolume.sh
Created November 17, 2017 20:31
Tag Snapshots from Volume
#!/bin/bash
snapids=( $(aws ec2 describe-snapshots --owner-id self --filter "Name=status,Values=completed" --output text --query 'Snapshots[?!not_null(Tags[?Key == `rs:project`].Value)] | [].[SnapshotId]') )
for snapid in ${snapids[@]}; do
echo "Getting volume for snapshot ${snapid}"
volid=$(aws ec2 describe-snapshots --output text --snapshot-ids ${snapid} --query 'Snapshots[].VolumeId')
echo "Getting rs:* tags for volume ${volid}"
tags=$(aws ec2 describe-volumes --volume-ids ${volid} --query 'Volumes[].Tags[?starts_with(Key, `rs:`)][]' 2>/dev/null)
if [ "${tags}" != "" ]; then
@jspiewak
jspiewak / tagvolumesfrominstance.sh
Last active November 17, 2017 21:20
Tag Volumes from Instance
#!/bin/bash
volids=( $(aws ec2 describe-volumes --output text --filters "Name=attachment.status,Values=attached" --query 'Volumes[?!not_null(Tags[?Key == `rs:project`].Value)] | [].[VolumeId]') )
for volid in ${volids[@]}; do
echo "Getting instance for volume ${volid}"
instanceid=$(aws ec2 describe-volumes --output text --volume-ids ${volid} --query 'Volumes[].Attachments[].InstanceId')
echo "Getting rs:* tags for instance ${instanceid}"
tags=$(aws ec2 describe-instances --instance-ids ${instanceid} --query 'Reservations[].Instances[].Tags[?starts_with(Key, `rs:`)][]')
if [ "${tags}" != "" ]; then
@jspiewak
jspiewak / iTermManPagerHandler
Last active July 14, 2022 15:17
Configure iTerm2 to handle x-man-page URLs
- Create a new profile, e.g. Man Page Viewer
- Set the command to `bash -c "echo $$HOST$$ | sed -E 's/(.*)\/(.*)/\1 \2/' | xargs man"`
- Select x-man-page from the "Schemes handled" drop down
@jspiewak
jspiewak / pt.rb
Last active August 29, 2015 14:02
PivotalTracker Sprint Breakdown by Team Member
#!/usr/bin/env ruby
require 'net/http'
require 'json'
require 'time'
class PivotalTracker
attr_accessor :token, :project
def initialize(args)
@token = args[0]
@jspiewak
jspiewak / grails
Created May 23, 2014 16:47
Grails autocomplete
export GRAILS_VERSION="$(ls -lhr $HOME/.grails | egrep -i '1\.' | head -1 | awk '{print $9 }')"
sed_option="-E"
[ "$(uname)" == "Linux" ] && sed_option="-r"
_get_domain_classes(){
find ./grails-app/domain -iname *.groovy 2> /dev/null | tr \\n ' ' | sed 's/\.groovy//g' | sed 's/\.\/grails-app\/domain\///g' | tr '/' \.
}
@jspiewak
jspiewak / Q5.scpt
Created February 22, 2014 02:48
Copy iTunes music to SD card
set dest to choose folder
tell application "iTunes"
set the_tracks to tracks of playlist "Audi Q5 MMI"
repeat with t in the_tracks
set ll to get location of t
set a to album artist of t
if length of a = 0 then
@jspiewak
jspiewak / trace-all-events.js
Last active December 20, 2015 20:59 — forked from bnoordhuis/trace-all-events.js
Assign each object an id and log emitted events with the id.
(function() {
var id = 0;
function generateId() { return id++; };
Object.prototype.id = function() {
var newId = generateId();
this.id = function() { return newId; };
@jspiewak
jspiewak / LogbackJmxConfiguratorManager
Created October 10, 2012 13:51
Exposing Logback via JMX in Dropwizard
package com.yammer.dropwizard;
import ch.qos.logback.classic.Logger;
import ch.qos.logback.classic.LoggerContext;
import ch.qos.logback.classic.jmx.JMXConfigurator;
import ch.qos.logback.classic.jmx.MBeanUtil;
import com.yammer.dropwizard.lifecycle.Managed;
import org.slf4j.LoggerFactory;
import javax.management.MBeanServer;