Skip to content

Instantly share code, notes, and snippets.

👯
OMG

Ian Vaughan IanVaughan

👯
OMG
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
View keybase.md

Keybase proof

I hereby claim:

  • I am ianvaughan on github.
  • I am ianvaughan (https://keybase.io/ianvaughan) on keybase.
  • I have a public key ASBmI8mXmSPZzrv-iV4qgzMzeyHiWyoNmEEn7GnQHkViOAo

To claim this, I am signing this object:

@IanVaughan
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']
View rebuild.sh
#!/usr/bin/env ruby
# Usage :
# In slack `/todo list`
# Copy output, pipe into this script
file = ARGV[0]
data = File.read(file)
# sed -e 's/.*`\(.*\)`.*/git merge --no-edit --no-ff origin\/\1/'
FIND = /.*`(.*)`.*/
@IanVaughan
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__)
end
def init(state), do: {:ok, state}
def handle_call(:test, _from, %{call_timeout: call_timeout} = state) do
@IanVaughan
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__)
end
def init(opts) do
self() |> IO.inspect(label: "#{__MODULE__}.init returing :ok, pid")
@IanVaughan
IanVaughan / play.ex
Last active Aug 10, 2018
elixir genserver process stop from init within start_child supervisor restart
View play.ex
iex> self()
#PID<0.111.0>
iex> Runner.run
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
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)
end
@IanVaughan
IanVaughan / api-console
Created May 14, 2018
Get a Rails Console to CoreAPI
View api-console
# Usage
# api-console staging
ENV=$1
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
IanVaughan / docker-cleanup-resources.md
Created Aug 18, 2017 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks
View docker-cleanup-resources.md

Docker - How to cleanup (unused) resources

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

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)
$ docker volume ls -qf dangling=true | xargs -r docker volume rm
@IanVaughan
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.