Skip to content

Instantly share code, notes, and snippets.

@andrewpage
andrewpage / pre-commit.rb
Created October 20, 2015 04:11
Rubocop pre-commit hook
#!/usr/bin/env ruby
# Grab a list of staged changed files
changed_files = `git diff --name-only HEAD`.split("\n")
should_fail, broken_files = false, []
changed_files.each do |file|
# Run static code analysis on changed file
output = `rubocop #{file} --format simple`
@andrewpage
andrewpage / report-passenger.rb
Last active April 12, 2022 22:06
Report Phusion Passenger metrics to AWS CloudWatch.
#!/usr/bin/env ruby
#
# Report Instance Count and Request Queue Size metrics from locally running Phusion Passenger instance.
# Author: Andrew Page <andrew@andrewpage.me>
# ==
# Phusion Passenger: https://www.phusionpassenger.com
require 'net/http'
require 'phusion_passenger'
require 'aws-sdk'

Keybase proof

I hereby claim:

  • I am andrewpage on github.
  • I am andrewpage (https://keybase.io/andrewpage) on keybase.
  • I have a public key whose fingerprint is ECC3 0E1E A1F0 4D34 90D5 75A5 2CB3 1AC2 B59E 3F5A

To claim this, I am signing this object:

set nocompatible " be iMproved, required
filetype off " required
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" => Plugins
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Auto-install vim-plug
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
controller action user_count
\disruptors/request_for_data"" \index"" 7667
\matches"" \unaccepted"" 7263
\matches"" \show"" 7198
\matches"" \index"" 4015
\progress_reports"" \progress_report"" 3989
\matches"" \proposal"" 3559
\matches"" \lead_type"" 2652
\users"" \show"" 2226
@andrewpage
andrewpage / scpt
Created June 18, 2015 00:28
function to scp through a jumphost
function scpt {
origin=$1
origin_filename=$(basename $origin)
jumphost=$2
destination=$3
echo "SCPing '$origin' through jumphost '$jumphost' to destination '$destination'."
cat < $origin | ssh $jumphost "cat > $origin_filename && scp $origin_filename $destination && rm $origin_filename"