Skip to content

Instantly share code, notes, and snippets.


Patrick Reagan reagent

View GitHub Profile
reagent / vcr_strip_credentials_from_params.rb
Created Aug 8, 2019
Example of stripping credentials / sensitive data from GET params when using VCR (5.0.x)
View vcr_strip_credentials_from_params.rb
class URLSanitizer
def self.equal?(first, second)
new(first) == new(second)
def self.sanitize(url)
def initialize(url)
reagent / migrator.rb
Created Nov 21, 2017
DIY migrations in Ruby
View migrator.rb
require 'pg'
require 'uri'
class Migrator
class Migration
def initialize(connection, path)
@connection, @path = connection, path
reagent / 01_basic.go
Last active Aug 27, 2020
Custom HTTP Routing in Go
View 01_basic.go
package main
import (
func main() {

Installing libcurl with Updated OpenSSL Support

If your Linux distribution is so out of date that you can no longer install updated patches, you'll typically need to either reach for an unsupported package or install the software via source. Additionally, I didn't want to interfere with installed software in fear of rendering the system unusable.

Become Root and Grab Tarballs

You're going to be installing stuff that requires root access, so it's easier to just be able to do it when you want without having to worry about using sudo and permissions. Be careful you don't delete anything you can't recover

$ sudo su - 
View check-gzip
#!/usr/bin/env ruby
url = ARGV.pop
if url.to_s.strip.length == 0
puts "Error: Please supply a URL"
exit 1
uncompressed_bytes = `curl "#{url}" --silent --write-out "%{size_download}\n" --output /dev/null`
reagent /
Last active Oct 30, 2019
Downgrade Apache + PHP on Ubuntu 14.04
cat <<EOF >> /etc/apt/sources.list
deb precise main restricted universe
deb precise-updates main restricted universe
deb precise-security main restricted universe multiverse
apt-get update
apt-get purge \
apache2 \
reagent /
Last active Aug 15, 2019
Convert whitespace from tabs to 2 spaces
set -e # fail on nonzero status
cd $1
files=`find . \
-not \( -path ./vendor -prune \) \
-not \( -path ./tmp -prune \) \
-name '*.html' -o -name '*.js' -o -name '*.coffee' -o \
reagent / .gitignore
Last active May 14, 2020
Curses Windowing Example
reagent / .gitignore
Last active May 13, 2020
Curses + C Example
You can’t perform that action at this time.