Skip to content

Instantly share code, notes, and snippets.

View rpond-pa's full-sized avatar

Randy Pond rpond-pa

View GitHub Profile
@rpond-pa
rpond-pa / result
Last active November 17, 2015 21:32
Ruby VM Instruction Sequence
== disasm: <RubyVM::InstructionSequence:<compiled>@<compiled>>==========
0000 trace 1 ( 1)
0002 putspecialobject 1
0004 putspecialobject 2
0006 putobject :foo
0008 putiseq foo
0010 opt_send_simple <callinfo!mid:core#define_method, argc:3, ARGS_SKIP>
0012 pop
0013 trace 1 ( 4)
0015 putself
@rpond-pa
rpond-pa / gist:f245dcfd762342ef2d73
Created February 11, 2015 18:43
asci art comment
# ____ ____ ____ ____ _________ ____ ____ ____ ____
# ||R |||E |||A |||D ||| |||T |||H |||I |||S ||
# ||__|||__|||__|||__|||_______|||__|||__|||__|||__||
# |/__\|/__\|/__\|/__\|/_______\|/__\|/__\|/__\|/__\|
# ____ ____ ____ ____ ____ ____ ____ ____ ____ ____
# ||W |||A |||R |||N |||I |||N |||G |||! |||! |||! ||
# ||__|||__|||__|||__|||__|||__|||__|||__|||__|||__||
# |/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\|/__\|
#
@rpond-pa
rpond-pa / docker-enter
Created December 16, 2014 22:56
Docker Enter script
#!/bin/bash
set -e
# Check for nsenter. If not found, install it
boot2docker ssh '[ -f /var/lib/boot2docker/nsenter ] || docker run --rm -v /var/lib/boot2docker/:/target jpetazzo/nsenter'
# Use bash if no command is specified
args=$@
if [[ $# = 1 ]]; then
args+=(/bin/bash)
#!/usr/bin/env ruby
require 'redis'
# Clear a large number of keys matching a pattern using SCAN and
# pipelining to avoid killing the server.
class ClearKeys
def initialize(pattern, host='localhost', postprocess_pattern=nil)
@redis = Redis.new(host: host)
@pattern = pattern
#!/usr/bin/env ruby
require 'redis'
# Clear a large number of keys matching a pattern using SCAN and
# pipelining to avoid killing the server.
class ClearKeys
def initialize(pattern, host='localhost', postprocess_pattern=nil)
@redis = Redis.new(host: host)
@pattern = pattern
alias.br branch
alias.bra branch -a
alias.check diff --check
alias.ci commit -v
alias.cl clone
alias.co checkout
alias.com checkout master
alias.cp cherry-pick
alias.d diff
alias.dc diff --cached
def randys_version(current_url)
e = ->(e) { e.tr "A-Za-z", "N-ZA-Mn-za-m" }
vs = [freak=e.('ue_fhvgr'),e.('nccyvpnag_cbegny')]
z = ->(w,i) { w.split(e.('_'))[i] }
ks = vs.map.with_index {|zi,i| z.(zi,i) }
Hash[ks.zip(vs)][current_url] || vs[1]
end
booty = ->(t) { t ? nil : throw(:whoops) }
booty.call randys_version 'portal' == 'applicant_portal'
@rpond-pa
rpond-pa / who_is_awesome.rb
Created July 18, 2013 21:59
I had to see it for myself. From http://instacod.es/77752
$ irb
irb(main):001:0> class WhoIsAwesome
irb(main):002:1> YOU_ARE = "
irb(main):003:1" .-. . . . .-. .-. .-. . . .-.
irb(main):004:1" |-| | | | |- `-. | | |\/| |-
irb(main):005:1" ` ' `.'.' `-' `-' `-' ' ` `-' "
irb(main):006:1> define_method(YOU_ARE) do
irb(main):007:2* puts "This is insane"
irb(main):008:2> end
irb(main):009:1> end