Skip to content

Instantly share code, notes, and snippets.


Justin MacCarthy macarthy

View GitHub Profile
View gist:6f8cf31efed8d5fc0038
mobile web,8
web development,5
mobile apps,5
macarthy / find_pdf_field
Last active Jan 1, 2016
Small utility to find the relevant field in a PDF form Usage find_pdf_field myfile.pdf searchstring
View find_pdf_field
# Usage: ruby find_pdf_field myfile.pdf searchstring
require 'pdf_forms'
require 'pp'
pdftk ="/usr/local/bin/pdftk")
pdf = ARGV[0]
# herein we backup our indexes! this script should run at like 6pm or something, after logstash
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas,
# compress the data files, create a restore script, and push it all up to S3.
TODAY=`date +"%Y.%m.%d"`
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
YEARMONTH=`date +"%Y-%m"`
View vim.rb
require 'formula'
class Vim < Formula
homepage ''
url '', :revision => '6c318419e331'
version '7.3.515'
def features; %w(tiny small normal big huge) end
def interp; %w(lua mzscheme perl python python3 tcl ruby lua) end
View pivotal.rb
#!/usr/bin/env ruby
require 'pivotal-tracker'
require 'yaml'
TEMP_DIR = "#{ENV['HOME']}/.pivotal/"
TEMP_FILE = TEMP_DIR + "temp.yml"
CONFIG_FILE = TEMP_DIR + "config.yml"
unless TEMP_DIR
macarthy / gist:5500174
Created May 2, 2013
Some links relating to Simons talk.
View gist:5500174
The Tech Industry’s Darkest Secret: It’s All About Age
Older Is Wiser: Study Shows Software Developers’ Skills Improve Over Time
View gist:5219554
require 'prawn'
def header
grid([0,0],[1,3]).bounding_box do
bounding_box([0,cursor], :width => 200, :height => 30) do
fill_color "d7800f"
fill_rectangle [bounds.left,],bounds.width,bounds.height
macarthy / gist:5110083
Last active Dec 14, 2015
slow postgresql query
View gist:5110083
Column | Type | Modifiers | Storage | Stats target | Description
id | integer | not null default nextval('tags_id_seq'::regclass) | plain | |
type | character varying(255) | | extended | |
label | character varying(255) | | extended | |
created_at | timestamp without time zone | not null | plain | |
updated_at | timestamp without time zone | not null | plain | |
"tags_pkey" PRIMARY KEY, btree (id)
View gist:1526993
➜ gittest git:(master) git log
commit 6be414305b3f968f975c3d33cd86b9d9beb17f77
Author: Justin MacCarthy <>
Date: Wed Dec 28 14:37:46 2011 +0700
added c.txt
commit 954758efede9490e3e1b87753402e95f64ce7263
Author: Justin MacCarthy <>
Date: Wed Dec 28 14:37:28 2011 +0700