Skip to content

Instantly share code, notes, and snippets.

log syslog all;
router id **MY_IP**;
protocol bgp vultr {
local as 395409;
source address **MY_IP**;
import none;
export all;
graceful restart on;
@kyledrake
kyledrake / gist:3077989
Created July 9, 2012 18:14
Ruby code for doing P12 to PEM conversion via command line. Supports MRI/JRuby/Rubinius
require 'tempfile'
require 'openssl'
require 'escape' # gem install escape
class CommandFailError < StandardError; end
def p12_to_pem_text(p12, pass='')
pass = '' if pass.nil?
# Use shell command for JRuby (see https://github.com/jruby/jruby-ossl/issues/8)
@kyledrake
kyledrake / Keybase Proof
Created August 16, 2017 19:23
Keybase Proof
### Keybase proof
I hereby claim:
* I am kyledrake on github.
* I am kyledrake (https://keybase.io/kyledrake) on keybase.
* I have a public key whose fingerprint is B128 E73F A18D ABCB 88D4 087B D184 D8CD DCE6 F6D4
To claim this, I am signing this object:
@kyledrake
kyledrake / bitcoincash.js
Created August 15, 2017 01:43
Spends from a 2 of 3 multisig to a pubkeyhash with Bitcoin Cash (UNTESTED)
/* npm install -g https://github.com/afk11/bitcoinjs-lib/tarball/opt-in-bitcoincash-sighash */
/*
This script spends from a 2 of 3 multisig to a pubkeyhash using Bitcoin Cash
*/
var bitcoin = require('bitcoinjs-lib')
var network = bitcoin.networks['bitcoin']
var outputValue = 4500000 // How much to send (remainder is the miner fee)
var inputValue = 4600000 // utxo value is required for bitcoin cash signature
@kyledrake
kyledrake / ceph-grow-rbd-xfs
Created March 14, 2017 03:58 — forked from briancline/ceph-grow-rbd-xfs
Growing a Ceph RBD volume and an XFS filesystem contained within
# df -h /dev/rbd0
Filesystem Size Used Avail Use% Mounted on
/dev/rbd0 1.5T 1.5T 557M 100% /mnt/media
# rbd info media/media01
rbd image 'media01':
size 1536 GB in 393216 objects
order 22 (4096 kB objects)
block_name_prefix: rb.0.1098.74b0dc51
format: 1
@kyledrake
kyledrake / bird.conf
Last active September 22, 2016 19:34
newbird.conf
log syslog all;
router id **MY_IP**;
protocol bgp vultr {
local as 395409;
source address **MY_IP**;
import none;
export all;
graceful restart on;
# NOTE: Both of these would have best been served by the server in Seattle.
traceroute to 198.51.233.1 (198.51.233.1), 30 hops max, 60 byte packets
1 192.168.1.1 0.444 ms 0.408 ms 0.396 ms
2 * * *
3 xe-3-0-2-sur04.troutdale.or.bverton.comcast.net (68.87.217.233) 12.892 ms 13.820 ms 13.823 ms
4 ae-52-ar01.troutdale.or.bverton.comcast.net (68.87.216.253) 13.816 ms 14.033 ms 13.788 ms
5 ae-2-ar01.beaverton.or.bverton.comcast.net (68.85.146.77) 15.029 ms * *
6 be-33490-cr01.sunnyvale.ca.ibone.comcast.net (68.86.92.205) 28.049 ms 27.238 ms 27.161 ms
7 be-10915-cr02.losangeles.ca.ibone.comcast.net (68.86.86.98) 35.109 ms 34.202 ms 31.920 ms
@kyledrake
kyledrake / gist:1498932
Last active August 2, 2016 04:31
Neocities' Rainbows! config file - https://neocities.org
# This is Neocities' Rainbows! config file. We are using this in production to run all our web apps.
# It works really well for us and has been heavily load tested, so I wanted to share it with the community.
#
# In my opinion, this is the best way to deploy a ruby web application. Unlike EventMachine based solutions,
# it uses real ruby threads, which allows it to take advantage of the internal non-blocking IO pattern
# in MRI.
#
# Contrary to popular belief, MRI doesn't block execution to wait on IO when you are using threads, even
# with the GIL. The requests are done concurrently for anything that is based on the IO class. This
# includes things like Net::HTTP and even `system commands`. Grep the MRI Ruby source code for
@kyledrake
kyledrake / http.cr
Created June 20, 2016 21:54
Crystal HTTP Benchmark
# A very basic HTTP server
require "http/server"
server = HTTP::Server.new(8080) do |context|
context.response.content_type = "text/plain"
context.response.print "Hello world"
end
puts "Listening on http://0.0.0.0:8080"
server.listen
@kyledrake
kyledrake / internet_radio_stream_aliases.sh
Created June 20, 2016 20:07 — forked from pwenzel/internet_radio_stream_aliases.sh
Internet Radio Streams Via Command Line
# 1. Install mplayer command line (via Brew, Macports, or APT)
# 2. Add the following aliases to ~/.profile
# 3. Type `source ~/.profile`
# 3. Type `news` or `current` to listen in your terminal
alias news="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/news.pls" # MPR News
alias current="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/the_current.pls" # The Current
alias classical="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/classical.pls" # Classical MPR
alias localcurrent="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/local.pls" # Local Current
alias heartland="mplayer -playlist http://minnesota.publicradio.org/tools/play/streams/radio_heartland.pls" # MPR Radio Heartland