Skip to content

Instantly share code, notes, and snippets.


Ian Vaughan IanVaughan

Block or report user

Report or block IanVaughan

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

Keybase proof

I hereby claim:

  • I am ianvaughan on github.
  • I am ianvaughan ( on keybase.
  • I have a public key ASBmI8mXmSPZzrv-iV4qgzMzeyHiWyoNmEEn7GnQHkViOAo

To claim this, I am signing this object:

IanVaughan / k8s.rb
Created Sep 4, 2018
Script to get logs or a console into k8s pods
View k8s.rb
# gem install tty-prompt
# gem install tty-command
require 'tty-prompt'
require 'tty-command'
require 'thor'
require 'pry'
class MyCLI < Thor
class_option :env, type: :string, default: ENV['K8S_ENV']
#!/usr/bin/env ruby
# Usage :
# In slack `/todo list`
# Copy output, pipe into this script
file = ARGV[0]
data =
# sed -e 's/.*`\(.*\)`.*/git merge --no-edit --no-ff origin\/\1/'
FIND = /.*`(.*)`.*/
IanVaughan / play.exs
Created Aug 15, 2018
elixir nested timeout
View play.exs
defmodule CallsProcess do
use GenServer
def start_link(state) do
GenServer.start_link(__MODULE__, state, name: __MODULE__)
def init(state), do: {:ok, state}
def handle_call(:test, _from, %{call_timeout: call_timeout} = state) do
IanVaughan / timeout.ex
Last active Aug 10, 2018
elixir genserver timeouts
View timeout.ex
defmodule CallsProcessOnTimeout do
use GenServer
def start_link(opts) do
self() |> IO.inspect(label: "#{__MODULE__}.start_link")
GenServer.start_link(__MODULE__, opts, name: __MODULE__)
def init(opts) do
self() |> IO.inspect(label: "#{__MODULE__}.init returing :ok, pid")
IanVaughan / play.ex
Last active Aug 10, 2018
elixir genserver process stop from init within start_child supervisor restart
View play.ex
iex> self()
Elixir.MySupervisor.init, pid: #PID<0.115.0>
Elixir.ProcessThatCrashesInInit.init returing :ok, pid: #PID<0.116.0>
sup_pid: #PID<0.115.0>
child_pid: #PID<0.116.0>
Killing 1
Killing 2
IanVaughan / sigstr_kafka_monitor.ex
Created Aug 2, 2018
Code from ib/sigstr_kafka_monitor.ex incase its pulled.
View sigstr_kafka_monitor.ex
defmodule SigstrKafkaMonitor do
use GenServer
require Logger
@restart_wait_seconds 60
@retry_produce_seconds 1
def start_link(opts \\ []) do
GenServer.start_link(__MODULE__, opts, name: SigstrKafka)
IanVaughan / api-console
Created May 14, 2018
Get a Rails Console to CoreAPI
View api-console
# Usage
# api-console staging
echo "* Finding POD on: $ENV"
POD=$(kubectl --context $ENV get pods | grep core-api-app | tail -n 1 | cut -d " " -f 1)
echo "* Execing into: $POD"
kubectl --context $ENV exec -it $POD rails c
IanVaughan /
Created Aug 18, 2017 — forked from bastman/
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see:

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
IanVaughan / rebuild.rb
Last active Jul 25, 2017
Convert todo list into git merge commands
View rebuild.rb
#!/usr/bin/env ruby
# Usage :
# In slack `/todo list`
# Copy output into a file, eg branches.txt
# Run this against branches.txt
# ./rebuild branches.txt
# Output
# git reset origin/master --hard
# git merge --no-edit --no-ff origin/fix1
You can’t perform that action at this time.