Skip to content

Instantly share code, notes, and snippets.

Avatar

Justin MacCarthy macarthy

View GitHub Profile
View gist:6f8cf31efed8d5fc0038
subject,count
node.js,11
mobile web,8
java,8
python,5
web development,5
mobile apps,5
networking,4
android,4
etc.,4
@macarthy
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
#!/bin/ruby
# Usage: ruby find_pdf_field myfile.pdf searchstring
require 'pdf_forms'
require 'pp'
pdftk = PdfForms.new("/usr/local/bin/pdftk")
pdf = ARGV[0]
View backup.sh
#!/bin/bash
# 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
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/"
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put"
BACKUPDIR="/mnt/es-backups/"
YEARMONTH=`date +"%Y-%m"`
View vim.rb
require 'formula'
class Vim < Formula
homepage 'http://www.vim.org/'
url 'https://vim.googlecode.com/hg/', :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 File.directory? TEMP_DIR
@macarthy
macarthy / gist:5500174
Created May 2, 2013
Some links relating to Simons talk.
View gist:5500174
Age:
The Tech Industry’s Darkest Secret: It’s All About Age
http://www.linkedin.com/today/post/article/20130422020049-8451-the-tech-industry-s-darkest-secret-it-s-all-about-age
Older Is Wiser: Study Shows Software Developers’ Skills Improve Over Time
http://news.ncsu.edu/releases/wms-murphyhill-age-2013/
http://www.codingninja.co.uk/like-fine-wine-developers-can-become-better-with-age/
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.top],bounds.width,bounds.height
stroke_bounds
end
@macarthy
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 | |
Indexes:
"tags_pkey" PRIMARY KEY, btree (id)
"add_uni
View gist:1526993
➜ gittest git:(master) git log
commit 6be414305b3f968f975c3d33cd86b9d9beb17f77
Author: Justin MacCarthy <Justin@Rubystars.biz>
Date: Wed Dec 28 14:37:46 2011 +0700
added c.txt
commit 954758efede9490e3e1b87753402e95f64ce7263
Author: Justin MacCarthy <Justin@Rubystars.biz>
Date: Wed Dec 28 14:37:28 2011 +0700