Skip to content

Instantly share code, notes, and snippets.

View patrobinson's full-sized avatar

Patrick Robinson patrobinson

View GitHub Profile
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
@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 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 / 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)"
}
@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 / .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
INIT='eval $(docker-machine env docker5)'
PARSE = 'echo parse_url("http://google.com#@example.com/", PHP_URL_HOST);'
READ = 'echo readfile("http://google.com#@example.com/");'
versions = []
14.upto 25 do |i|
versions << "7.0.#{i}"
@patrobinson
patrobinson / update_ddb_from_stream.py
Created February 20, 2018 02:44
(SO0037) - Real Time Insights on AWS Account Activity
#!/usr/bin/python
# -*- coding: utf-8 -*-
##############################################################################
# Copyright 2017 Amazon.com, Inc. or its affiliates. All Rights Reserved. #
# #
# Licensed under the Amazon Software License (the 'License'). You may not #
# use this file except in compliance with the License. A copy of the #
# License is located at #
# #
/* eslint-env es6 */
'use strict';
var assert = require('assert');
let harness = (req, res, callback, next) => {
try {
assert.equal(typeof callback, 'function');
} catch (E) {
return callback(E);
}
try {
@patrobinson
patrobinson / .bashrc
Last active July 11, 2021 23:03
aws vault bash profile
function aws-code() {
ykman oath -s bastion-account
}
function aws-vault-exec() {
local role_name=$1
export AWS_ACCOUNT=$role_name
shift
local command=$@
local extra_args=""