Skip to content

Instantly share code, notes, and snippets.

View j-wilkins's full-sized avatar

Jake Wilkins j-wilkins

View GitHub Profile
@j-wilkins
j-wilkins / papajohns.rb
Last active January 28, 2017 05:45
Order a Favorite Pizza from Papa Johns
require 'mechanize'
class PapaOrder
SN_URL = 'https://order.papajohns.com/secure/signin/frame.html?destination='
attr_reader :agent, :password, :email
def initialize(email, password)
@email, @password = email, password
@agent = Mechanize.new
@j-wilkins
j-wilkins / mount.stl
Last active August 29, 2015 14:06
Door Mount
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
### Keybase proof
I hereby claim:
* I am j-wilkins on github.
* I am jwilkins (https://keybase.io/jwilkins) on keybase.
* I have a public key whose fingerprint is 52C8 9629 A40E 5FCF B7D3 CE53 A3A6 3447 C2C0 B9BD
To claim this, I am signing this object:
catspam() {
curl -vvvv -d "{\"Body\":\"${1}\"}" -H "Content-Type: application/json" http://catspammer.com/api/cat
say "meow"
}
@j-wilkins
j-wilkins / gist:6074010
Created July 24, 2013 20:02
geocoder error backtrace
/ruby-2.0.0-p247@global/gems/geocoder-1.1.8/lib/geocoder/query.rb:20:in `sanitized_text'
/ruby-2.0.0-p247@global/gems/geocoder-1.1.8/lib/geocoder/lookups/google.rb:40:in `query_url_google_params'
/ruby-2.0.0-p247@global/gems/geocoder-1.1.8/lib/geocoder/lookups/google.rb:57:in `query_url_params'
/ruby-2.0.0-p247@global/gems/geocoder-1.1.8/lib/geocoder/lookups/base.rb:128:in `url_query_string'
/ruby-2.0.0-p247@global/gems/geocoder-1.1.8/lib/geocoder/lookups/google.rb:16:in `query_url'
/ruby-2.0.0-p247@global/gems/geocoder-1.1.8/lib/geocoder/lookups/base.rb:139:in `cache_key'
/ruby-2.0.0-p247@global/gems/geocoder-1.1.8/lib/geocoder/lookups/base.rb:200:in `fetch_raw_data'
/ruby-2.0.0-p247@global/gems/geocoder-1.1.8/lib/geocoder/lookups/base.rb:166:in `fetch_data'
/ruby-2.0.0-p247@global/gems/geocoder-1.1.8/lib/geocoder/lookups/google.rb:22:in `results'
/ruby-2.0.0-p247@global/gems/geocoder-1.1.8/lib/geocoder/lookups/base.rb:44:in `search'
@j-wilkins
j-wilkins / tmux-macosx-pasteboard.rb
Created February 6, 2013 19:32
Homebrew formula for installing tmux-MacOSX-pasteboard.
require 'formula'
class TmuxMacosxPasteboard < Formula
homepage 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard'
url 'https://github.com/ChrisJohnsen/tmux-MacOSX-pasteboard/archive/v2.0.tar.gz'
sha1 'bf9342ccc1240f628fcfab887d99a61ff701446f'
def install
system 'make'
@j-wilkins
j-wilkins / redis_lua.rb
Created September 17, 2012 08:45
trivial Redis Lua scripts
r = Redis::Namespace.new(:resque, redis: Redis.new)
# the 'correct' way. Redis wants us to specify the keys we'll be operating
# on in the script as an argument to the eval command.
script = <<-LUA
local t = {}
for iter,value in ipairs(KEYS) do
table.insert(t, {value, redis.call('llen', value)})
@j-wilkins
j-wilkins / pacman.rb
Created February 29, 2012 19:55
Create a PDF pacman game
# Adapted from pdf-writer example by j-wilkins
#--
# PDF::Writer for Ruby.
# http://rubyforge.org/projects/ruby-pdf/
# Copyright 2003 - 2005 Austin Ziegler.
#
# Licensed under a MIT-style licence. See LICENCE in the main distribution
# for full licensing information.
#
# $Id: pac.rb,v 1.4.2.1 2005/08/25 03:38:05 austin Exp $
@j-wilkins
j-wilkins / gist:1879003
Created February 21, 2012 21:16
my tmux conf. nothing to see here.
set -g prefix C-a
unbind C-b
bind C-a send-prefix
bind-key C-a last-window
# keep lots of scrollback
set -g history-limit 1000000
# Set status bar
#set -g status-bg black
#set -g status-fg gray
@j-wilkins
j-wilkins / info
Created December 27, 2011 19:45
SHA1 point-making code.
A stupid example that shows nothing aside from the fact that SHA1 is fast. it's probably documented much more
thoroughly elsewhere.
The gist is this: we take approximately 100000 file paths, see how long it takes to loop through them purely for
comparison, then we see how long it takes to hash all 100000, then we go through and compare the string file paths
to an arbitrary string file path, and finally we go through and compare the hashed file path to a hashed arbitrary
file path.
The general results showing that, while the SHA1 does take significantly more time than a straight loop, it is still
fairly minuscule < .5 seconds. while you wouldn't want to be SHA1'ing 100000 file paths all the time, if you had to,