Skip to content

Instantly share code, notes, and snippets.

@keyan
keyan / modified_files.sh
Last active February 15, 2017 01:22
List files modified in the last commit
git diff-tree --no-commit-id --name-only -r HEAD
@keyan
keyan / codemod_capture.sh
Created February 18, 2017 06:44
codemod capture group usage (https://github.com/facebook/codemod)
codemod 'defmodule ([a-zA-Z]*) do' 'defmodule Models.\1 do' --extensions exs
@keyan
keyan / super-tip.txt
Created March 4, 2017 23:28 — forked from ericdouglas/super-tip.txt
Change 4 spaces to 2 spaces indentation - Vim tip
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g
@keyan
keyan / kill_processes
Last active March 12, 2017 14:01
Batch kill processes in AWS Aurora MySQL
#!/bin/bash
AURORA_USERNAME=
AURORA_PASS=
MYSQL_HOST=
mycli --host=$MYSQL_HOST -u $AURORA_USERNAME --password=$AURORA_PASS --database=session -e "SHOW processlist" | awk '$2 == "tpt3_app" {print $1}' > /tmp/process_ids
while read id; do
echo "killing process_id $id"
@keyan
keyan / load_testing_kube.md
Created April 24, 2017 18:47
quick kube load testing
$ kubectl run -i --tty load-generator --image=busybox /bin/sh

Hit enter for command prompt

$ while true; do wget -q -O- http://graph-api-staging.default.svc.cluster.local:443/graph/graphiql.html; done
@keyan
keyan / version_bump.rb
Created May 16, 2017 17:26
A script to handle chef cookbook versioning changes. Originally from http://blog.backslasher.net/cookbook-versioning.html but heavily modified and cleaned up.
#!/usr/bin/env ruby
require 'date'
require 'optparse'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: ./bump_version.rb -d <path to cookbook> [options]"
opts.separator ""
opts.separator "Increases the specified cookbook's version in metadata.rb+environments/staging.json"
@keyan
keyan / image_diff.py
Created June 6, 2017 21:32
quick script to find differences between cached/non-cached thumbnails
import csv
import urllib
from PIL import Image, ImageChops
def same_image(image1, image2):
return ImageChops.difference(img1, img2).getbbox() is None
@keyan
keyan / gist:dbf75af329b2c2294e8775d4d32cb3e0
Created June 17, 2017 21:04
sumersville lake camping beta
Summersville Lake Dam
- take 19 North until you get to Summersville Lake Rd
- There will be a gas station/"travel plaza" to the right, take a left at that light. (You'll know you're at the right place because there will be a billboard with Southern X-Posure facing north.)
- Take the road all the way until you cross over the Dam, it will be obvious.
- When you get across the dam, look for a park entrance on your left, right past the yellow with black arrow sign. Take the road all the way down to the camping area.

Installation

  • Halyard must be run on Ubuntu 14.04 (Trusty), you will likely use a VM to run it:
$ vagrant init ubuntu/trusty64; vagrant up --provider virtualbox
  • Sync your local kubeconfig with the guest VM by adding the following line to your newly created Vagrantfile:
@keyan
keyan / task1.exs
Created October 30, 2017 19:06 — forked from moklett/task1.exs
Elixir Task - Crash Handling
# This demonstrates that, when using async/await, a crash in the task will crash the caller
defmodule Tasker do
def good(message) do
IO.puts message
end
def bad(message) do
IO.puts message
raise "I'm BAD!"
end