Keybase proof

I hereby claim:

  • I am johngrimes on github.
  • I am johngrimes ( on keybase.
  • I have a public key whose fingerprint is A9C7 99F1 780B C172 5462 3F60 EA16 3ECF 6D3E 2BDA

To claim this, I am signing this object:

View somecode.rb
def index
@areas = Area.all
@area = Area.find_by(slug: params[:area_slug]).presence || Area.find_by(slug: 'city')
conditions = { area: @area.subtree }
conditions.merge! { |k,v|
[:bedrooms, :unit].include?(k) and !v.blank?
conditions[:property_type] = params[:type] || 'residential'
View alter-owner.sql
SELECT exec('ALTER TABLE ' || quote_ident(s.nspname) || '.' || quote_ident(s.relname) || ' OWNER TO $NEWUSER')
FROM (SELECT nspname, relname
FROM pg_class c JOIN pg_namespace n ON (c.relnamespace = n.oid)
WHERE nspname NOT LIKE E'pg\\_%' AND
nspname <> 'information_schema' AND
relkind IN ('r','S','v') ORDER BY relkind = 'S'
) s;
# Get the device identifier of the device, which is the one that currently does not have a valid partition table.
fdisk -l
# Use fdisk to create a new primary Linux partition, which takes up all of the available space.
fdisk /dev/sdb
# Make a new ext4 filesystem within the new partition.
mkfs -t ext4 /dev/sdb1
# Get the UUID of the new filesystem.
View newsyslog.conf
# Put this into /etc/newsyslog.conf, or into a .conf file under /etc/newsyslog.d/
# Format: [logfile_name] [owner:group] [mode] [count] [size] [when] [flags] [path_to_pid_file] [signal_number]
# See
# This trims any log file in this directory that has exceeded 10 MiB in size.
# The G flag allows you to use globbing in the logfile_name field.
/path/to/your/log/files/*.log user:group 640 0 10486 * G
View resync_id_sequences.sql
CREATE OR REPLACE FUNCTION resync_id_sequences() RETURNS void AS $$
table RECORD;
sequence_name VARCHAR;
id_present RECORD;
max_id RECORD;
FOR table IN SELECT * FROM information_schema.tables WHERE table_schema = 'public' LOOP
SELECT COUNT(*) AS count INTO id_present
FROM pg_attribute a INNER JOIN pg_class c
find public/images -name '*.png' | xargs optipng
find public/images -name '*.jpg' | xargs jpegoptim
View myapp.conf
upstream unicorn-myapp { server; }
server {
rewrite ^(.*)$1 permanent;
server {
listen *:80;
View date.sql
/* Adapted from Tom Cunningham's 'Data Warehousing with MySql' ( */
###### small-numbers table
DROP TABLE IF EXISTS numbers_small;
CREATE TABLE numbers_small (number INT);
INSERT INTO numbers_small VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
###### main numbers table
CREATE TABLE numbers (number BIGINT);
View deploy.rb
require 'bundler/capistrano'
require 'rvm/capistrano'
set :application, 'myapp'
set :repository, ''
set :scm, 'git'
set :bundle_flags, '--deployment'
set :bundle_without, []