Skip to content

Instantly share code, notes, and snippets.

View cmbankester's full-sized avatar

Christian Bankester cmbankester

  • Immense Networks
  • Baton Rouge, LA
View GitHub Profile
@cmbankester
cmbankester / homebrew.mxcl.nginx.plist
Last active April 29, 2022 14:08
NGINX startup on Mac OSX El Capitan
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>homebrew.mxcl.nginx</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
@cmbankester
cmbankester / file-event-watch.sh
Created May 21, 2015 01:39
Filter fswatch events by type
#!/bin/bash
# Usage:
# file-event-watch command-to-run path1 [path2, ...]
# TODO: Add fswatch event option to enable/disable different event types
cmd=$1
shift
files=$@
$cmd && fswatch -0 -x -r $files | {
@cmbankester
cmbankester / coreos-sync.sh
Last active June 18, 2018 09:19
Sync a directory into a CoreOS node using the unison container
#!/bin/sh
# add `export COREOS_DOCKER_HOST_IP=some-ip-address` to your .bashrc or .zshrc
function echo_usage_and_exit()
{
echo "Usage: coreos-sync local_path_to_sync remote_dir_to_sync_into [options]"
echo "Options:"
echo "\t-w\t\t(watches/resyncs on changes)"
echo "\t-v\t\t(enable verbose mode)"
@cmbankester
cmbankester / install.sh
Last active August 16, 2017 20:32
Nginx w/ Passenger & Ngx Pagespeed
# Install some deps with yum
yum install -y gcc openssl-devel libyaml-devel libffi-devel readline-devel zlib-devel gdbm-devel ncurses-devel libcurl-devel
# Install ngx_pagespeed
cd /usr/local/src
NPS_VERSION=1.9.32.2
wget https://github.com/pagespeed/ngx_pagespeed/archive/release-${NPS_VERSION}-beta.zip
unzip release-${NPS_VERSION}-beta.zip
cd ngx_pagespeed-release-${NPS_VERSION}-beta/
wget https://dl.google.com/dl/page-speed/psol/${NPS_VERSION}.tar.gz
@cmbankester
cmbankester / keybase.md
Created April 3, 2017 15:40
GitHub Verification for Keybase

Keybase proof

I hereby claim:

  • I am cmbankester on github.
  • I am cmbankester (https://keybase.io/cmbankester) on keybase.
  • I have a public key ASCyTmwo_SDYj2aJwZ4mrlYFnknPoxzR4gkAndEh77DMqQo

To claim this, I am signing this object:

@cmbankester
cmbankester / bug.rb
Last active October 5, 2016 17:44
Ruby file showing a potential bug with using scoped+argumented has_many :through in Rails 5
unless File.exist?('Gemfile')
File.write('Gemfile', <<-GEMFILE)
source 'https://rubygems.org'
gem 'rack', github: 'rack/rack'
gem 'rails', github: 'rails/rails'
gem 'sqlite3'
GEMFILE
system 'bundle'
end
@cmbankester
cmbankester / USAGE.md
Last active January 8, 2016 19:17
Rails Validator for Uniqueness Among Records Unmarked for Destruction
class Foo < ActiveRecord::Base
  belongs_to :bar, inverse_of: :foos
  validates :some_attribute,
            unmarked_for_destruction_uniqueness: {
                parent: :bar
              , children: :foos
              # , message: "Some message"
            }
end
@cmbankester
cmbankester / example.md
Last active January 5, 2016 21:44
Fish Shell Function Description Function
> ~ func-description func-description
Gets the description of a function> ~ 
@cmbankester
cmbankester / gist:4356146
Last active December 10, 2015 01:09
Install rbenv+ruby-build+1.9.3-p327
#!/bin/sh
git clone git://github.com/sstephenson/rbenv.git ~/.rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(rbenv init -)"' >> ~/.bash_profile
exec $SHELL -l
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
exec $SHELL -l
rbenv install 1.9.3-p374
#!/bin/sh
wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xzvf yaml-0.1.4.tar.gz
cd yaml-0.1.4
./configure --prefix=/usr/local
make
make install
cd
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p392.tar.gz
tar xzvf ruby-1.9.3-p392.tar.gz