Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am richleland on github.
  • I am richleland (https://keybase.io/richleland) on keybase.
  • I have a public key whose fingerprint is 3607 B152 BDE5 85EC 8E75 6841 8C3B 8696 6178 F2F2

To claim this, I am signing this object:

@richleland
richleland / desired.sql
Last active August 29, 2015 13:57
How can I do a search and replace in vim that will replace everything between "this as that" and "from", regardless of the number of columns being selected in between?
select
this as that,
*
from
table_name
select
this as that,
*
from
@richleland
richleland / tmux.conf
Created September 23, 2013 19:43
tmux conf
# change the tmux prefix
set -g prefix C-j
bind C-j send-prefix
unbind C-b
# lower delay, increase responsiveness
set -sg escape-time 1
# start window/pane numbering at 1
set -g base-index 1
/Users/rleland/.rvm/gems/ruby-1.9.3-p194/gems/librarian-0.1.0/lib/librarian/action/persist_resolution_mixin.rb:11:in `persist_resolution': undefined method `correct?' for nil:NilClass (NoMethodError)
from /Users/rleland/.rvm/gems/ruby-1.9.3-p194/gems/librarian-0.1.0/lib/librarian/action/resolve.rb:27:in `run'
from /Users/rleland/.rvm/gems/ruby-1.9.3-p194/gems/librarian-0.1.0/lib/librarian/cli.rb:169:in `resolve!'
from /Users/rleland/.rvm/gems/ruby-1.9.3-p194/gems/librarian-chef-0.0.1/lib/librarian/chef/cli.rb:41:in `install'
from /Users/rleland/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/command.rb:27:in `run'
from /Users/rleland/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/invocation.rb:120:in `invoke_command'
from /Users/rleland/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor.rb:363:in `dispatch'
from /Users/rleland/.rvm/gems/ruby-1.9.3-p194/gems/thor-0.18.1/lib/thor/base.rb:439:in `start'
from /Users/rleland/.rvm/gems/ruby-1.9.3-p194/gems/librarian-0.1.0/lib/librarian/cli.rb:26:
@richleland
richleland / Cheffile
Created April 23, 2013 14:10
librarian-chef install w/sensu 0.5.0
# from community.opscode.com
cookbook "sensu", "0.5.0"
# or from github
cookbook "sensu",
:git => "https://github.com/sensu/sensu-chef.git",
:ref => "0.5.0"
@richleland
richleland / ssl_via_proxy.py
Last active December 14, 2015 04:19 — forked from schlamar/gist:2993700
Code for handling https requests via proxy
import httplib
import urllib2
import ssl
import certifi
from backports.ssl_match_hostname import match_hostname
class CertValidatingHTTPSConnection(httplib.HTTPConnection):
default_port = httplib.HTTPS_PORT
export MODULE_PATH="/etc/puppet/modules/common"
mkdir -p $MODULE_PATH
for mod in apache foreman foreman_proxy passenger puppet tftp xinetd; do
mkdir -p $MODULE_PATH/$mod
wget http://github.com/theforeman/puppet-$mod/tarball/master -O - | tar xzvf - -C $MODULE_PATH/$mod --strip-components=1
done;
echo include puppet, puppet::server, foreman, foreman_proxy | puppet apply --modulepath $MODULE_PATH
import boto
conn = boto.connect_s3()
bucket = conn.get_bucket('some-bucket')
bucket.delete_keys(bucket.get_all_keys())
conn.delete_bucket('some-bucket')
@richleland
richleland / enc.py
Last active December 11, 2015 12:08
Python ENC and manifest that use AWS tags as classifiers
#! /usr/bin/env python
import yaml
import sys
from boto.ec2.connection import EC2Connection
ec2 = EC2Connection()
fqdn = sys.argv[1]
hostname = fqdn.split('.')[0]
#!/bin/bash
# set the hostname
echo "replace-me" > /etc/hostname
grep -q "127.0.0.1 replace-me" /etc/hosts || sed -i '1i127.0.0.1 replace-me' /etc/hosts
service hostname restart
# install saltstack-minion
add-apt-repository ppa:saltstack/salt-daily -y
apt-get update -y