Skip to content

Instantly share code, notes, and snippets.

View seamusabshere's full-sized avatar

Seamus Abshere seamusabshere

View GitHub Profile
@eliasp
eliasp / salt#master.sls
Last active December 27, 2015 20:29
Saltmaster Dockerfiles
python-pip:
pkg.installed
docker-py:
pip.installed:
- require:
- pkg: python-pip
# TODO: ensure docker-py is declared a requirement for all dockerio states without having to explicitely declare the requirement in each container state again
@pvh
pvh / gist:4634543
Last active December 11, 2015 17:28
Postgres: The Bits You Haven't Found talk
A Beastiary of Badassery
-
SQLisms
--
WITH
arrays and unnest
window functions
JSON
row types
@mperham
mperham / after.rb
Created July 4, 2012 19:30
Thread-friendly shared connection
class ActiveRecord::Base
mattr_accessor :shared_connection
@@shared_connection = nil
def self.connection
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection }
end
end
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection
@brianmario
brianmario / utf8_clean.rb
Last active December 9, 2020 20:21
Quick little pure-ruby UTF-8 string verification and cleaning utility
require 'strscan'
module UTF8Util
HIGH_BIT_RANGE = /[\x80-\xff]/n
ENCODING_SUPPORT = "".respond_to?(:force_encoding)
REPLACEMENT = "?"
# Check if this String is valid UTF-8
#
@harperreed
harperreed / mirror_site.sh
Created March 2, 2012 04:16
Mirror a site in s3
#!/bin/bash
#this will mirror a website, upload to s3, and make it publically available.
#install s3cmd. install wget. (i use homebrew).
#configure s3cmd (s3cmd --configure)
# run this by doing: mirror_site.sh www.example.org
wget --mirror -p --html-extension --convert-links -e robots=off -P . $1
s3cmd mb s3://$1