Skip to content

Instantly share code, notes, and snippets.

# 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
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 / 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
@kyledrake
kyledrake / config.ru
Created October 14, 2015 23:51
Puma "reverse proxy" debugging wackiness
# puma -p 31337 -q
require 'net/http'
run Proc.new { |env|
uri = URI('http://127.0.0.1:80/')
response = nil
Net::HTTP.start(uri.host, uri.port) do |http|
$ curl -kvv --tlsv1.2 https://sni.nakamura.io:4567/
* Trying 127.0.0.1...
* Connected to sni.nakamura.io (127.0.0.1) port 4567 (#0)
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* TLSv1.2 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (IN), TLS handshake, Server key exchange (12):
* TLSv1.2 (IN), TLS handshake, Server finished (14):
* TLSv1.2 (OUT), TLS handshake, Client key exchange (16):
@kyledrake
kyledrake / ipfs-refs-daemon.sh
Last active August 18, 2019 18:00
IPFS replication service with one line of unix shell code!
#!/bin/bash
# First, install ncat: http://nmap.org/ncat/
# Usually comes with the 'nmap' package on distributions.
ncat -k -v -l -p 5555 -c 'ipfs refs local | gzip'
# To retrieve on the client machine:
# nc 127.0.0.1 5555 | gunzip | ipfs pin add -r
@kyledrake
kyledrake / paypal.rb
Last active August 29, 2015 14:18
A not-crazy Paypal REST API interface.
# Everything else was worse...
# https://developer.paypal.com/docs/api/
require 'rest_client'
require 'addressable/uri'
require 'thread'
class Paypal
OAUTH2_IS_INCREDIBLY_SHITTY_COMEDY_TIME_PADDING = 10
SANDBOX_URI = Addressable::URI.parse 'https://api.sandbox.paypal.com/v1'
LIVE_URI = Addressable::URI.parse 'https://api.paypal.com/v1'
@kyledrake
kyledrake / boring.rb
Created April 5, 2015 23:52
Neocities boring web site detector
require 'rmagick'
require 'pry'
$filtered_sites = []
def web_site_too_blank?(path)
img = Magick::Image.read(path).first
pix = img.scale(1, 1)
average_color = pix.pixel_color(0,0)
@kyledrake
kyledrake / gist:d7457a46a03d7408da31
Last active October 22, 2023 12:25
Creating a self-signed SSL certificate, and then verifying it on another Linux machine
# Procedure is for Ubuntu 14.04 LTS.
# Using these guides:
# http://datacenteroverlords.com/2012/03/01/creating-your-own-ssl-certificate-authority/
# https://turboflash.wordpress.com/2009/06/23/curl-adding-installing-trusting-new-self-signed-certificate/
# https://jamielinux.com/articles/2013/08/act-as-your-own-certificate-authority/
# Generate the root (GIVE IT A PASSWORD IF YOU'RE NOT AUTOMATING SIGNING!):
openssl genrsa -aes256 -out ca.key 2048
openssl req -new -x509 -days 7300 -key ca.key -sha256 -extensions v3_ca -out ca.crt