Skip to content

Instantly share code, notes, and snippets.

View IanVaughan's full-sized avatar
👯‍♀️
OMG

Ian Vaughan IanVaughan

👯‍♀️
OMG
View GitHub Profile
@IanVaughan
IanVaughan / play.ex
Last active August 10, 2018 11:22
elixir genserver process stop from init within start_child supervisor restart
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 August 2, 2018 09:38
Code from ib/sigstr_kafka_monitor.ex incase its pulled.
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 08:30
Get a Rails Console to CoreAPI
# 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 August 18, 2017 20:56 — forked from bastman/docker-cleanup-resources.md
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: 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 July 25, 2017 15:57
Convert todo list into git merge commands
#!/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
@IanVaughan
IanVaughan / monitor_rancher.rb
Created March 30, 2017 11:56
Monitor a Rancher service and display popup toast notification when that service changes state
#!/usr/local/bin/ruby -w
# Usage:
# ./rancher_status.rb service_name
SERVICE = ARGV[0]
def notify(text)
title = "Rancher"
%x(osascript -e 'display notification "#{SERVICE} is #{text}" with title "#{title}"')
E, [2017-02-17T14:12:18.860398 #16633] ERROR -- #<Bunny::Session:0x4cf46b8 user@server.com:5672, vhost=core, addresses=[server.com:5672]>: Exception in the reader loop: AMQ::Protocol::EmptyResponseError: Empty response received from the server.
E, [2017-02-17T14:12:18.860486 #16633] ERROR -- #<Bunny::Session:0x4cf46b8 user@server.com:5672, vhost=core, addresses=[server.com:5672]>: Backtrace:
E, [2017-02-17T14:12:18.860537 #16633] ERROR -- #<Bunny::Session:0x4cf46b8 user@server.com:5672, vhost=core, addresses=[server.com:5672]>: /srv/www/quiqup_api/shared/bundle/ruby/2.3.0/gems/amq-protocol-2.1.0/lib/amq/protocol/frame.rb:60:in `decode_header'
E, [2017-02-17T14:12:18.860580 #16633] ERROR -- #<Bunny::Session:0x4cf46b8 user@server.com:5672, vhost=core, addresses=[server.com:5672]>: /srv/www/quiqup_api/shared/bundle/ruby/2.3.0/gems/bunny-2.6.3/lib/bunny/transport.rb:245:in `read_next_frame'
E, [2017-02-17T14:12:18.860609 #16633] ERROR -- #<Bunny::Session:0x4cf46b8 user@server.com:5672, vhost=core,
#!/usr/bin/env ruby
require 'net/https'
https = Net::HTTP.new('encrypted.google.com', 443)
https.use_ssl = true
https.verify_mode = OpenSSL::SSL::VERIFY_PEER
puts https.request_get('/')
### Keybase proof
I hereby claim:
* I am ianvaughan on github.
* I am ianvaughan (https://keybase.io/ianvaughan) on keybase.
* I have a public key whose fingerprint is 5830 FAC2 8E3B 08B5 6184 CC12 5433 14A1 C247 EC45
To claim this, I am signing this object:
@IanVaughan
IanVaughan / Phusion Passenger.txt
Created December 13, 2016 11:49
Phusion Passenger
Welcome to the Phusion Passenger Nginx module installer, v5.0.24.
This installer will guide you through the entire installation process. It
shouldn't take more than 5 minutes in total.
Here's what you can expect from the installation process:
1. This installer will compile and install Nginx with Passenger support.
2. You'll learn how to configure Passenger in Nginx.
3. You'll learn how to deploy a Ruby on Rails application.