Skip to content

Instantly share code, notes, and snippets.

View patrobinson's full-sized avatar

Patrick Robinson patrobinson

View GitHub Profile
@patrobinson
patrobinson / .bash_profile
Last active September 26, 2018 00:51
Using yubikey 4c on Mac OS X (running Sierra)
GPG_ENV=$( gpg-agent --daemon 2>/dev/null )
if [ $? == 0 ]; then
eval $GPG_ENV
else
export SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
fi
export GPG_TTY=$(tty)
function copy-code() {
echo $1 |sed -e 's/[^ ]* //' |pbcopy
@patrobinson
patrobinson / create_docker_cache.sh
Created May 22, 2017 02:40
Using docker images from s3 for caching
#!/bin/bash -e
# There's an assumption we're two directories into the repo (scripts/buildkite)
basedir=$(dirname $0)
pushd ${basedir}/../../
image_tag=$1
cache_sha_sum=$2
if [[ -z $image_tag || -z $cache_sha_sum ]]; then
@patrobinson
patrobinson / body_mapping_template
Created January 17, 2017 23:30
Sending non-json payloads to Lambda via AWS API Gateway
#set($inputRoot = $input.path('$'))
{
"httpMethod": "$context.httpMethod",
"input": "$util.escapeJavaScript($input.body)"
}
defmodule DogStatsdSupervisor do
use Supervisor
def start_link do
Supervisor.start_link(__MODULE__, :ok)
end
def init(:ok) do
children = [
worker(DogStatsd, [%{host: "localhost", port: 8125}, [name: DogStatsd]]),
@patrobinson
patrobinson / gist:496bbc8bf55f42dae3b6edf2ab8f8fc6
Created December 7, 2016 04:36
How to break buildkite with this one weird trick
### ./script/do_my_build.sh
source ./script/source_me.sh
echo "output a lot of lines"
for i in {1..100}; do
echo $i
done
### ./script/source_me.sh
defmodule DieCloudfilesDie.Devil.Minion do
use GenServer
@name __MODULE__
def start_link(container, agent_pid, marker_pid, parent_pid) do
{:ok, pid} = GenServer.start_link(__MODULE__, [container, agent_pid, marker_pid, parent_pid], name: @name)
end
def init(container, agent_pid, marker_pid, parent_pid) do
# Retrieve Marker
-module(chop).
-export([guess/3]).
-define(equal(Actual, Guess), Guess == Actual).
-define(lower(Actual, Guess), Guess > Actual).
guess(Actual, First, Last) ->
Guess = binary_guess(First, Last),
@patrobinson
patrobinson / gist:3ff278f264fdb1384a87
Last active August 29, 2015 14:18
Get Puppet 2.7 to work with Ruby 1.9
# I can't believe I'm doing this horrible hack, but Puppet 2.7 doesn't support
# Ruby versions above 1.8.7. Due to all the testing requirements
# we need to run Ruby 1.9.3. The only bug I've hit so far with Puppet 2.7
# and Ruby 1.9.3 is the lack of a "collect" method for a String
# which just needs to return an array of itself
# Turns out this is an undocumented feature in Ruby 1.8
#
# Add this to your spec_helper.rb file for use with rspec-puppet
class String
def collect
@patrobinson
patrobinson / README.md
Created March 23, 2015 12:40
ServiceNow Dashing config

ServiceNow dashing Meter

Shows the number of results returned by a query to ServiceNow

Usage

Add the following to your Gemfile gem 'rs_service_now'