Skip to content

Instantly share code, notes, and snippets.

View zph's full-sized avatar

Zander Hill zph

View GitHub Profile
require 'singleton' # => true
module Kernel
def d
DiceBag.instance
end
end
class DiceDSL
%r{^
(?<top_or_bottom>t|b)? # top or bottom info
(?<tb_number>\d)? # tb single digit
(?<dice>\[.*\]) # anything surrounded by []
(?<explode>\*)?\=? # conditional literal asterisk and =
(?<target>.*)?$
}x
@zph
zph / .vimrc
Last active August 29, 2015 14:00
" This folder is automatically created in zph's .zshrc
set backupdir=~/tmp/vim
set directory=~/tmp/vim " Don't clutter my dirs up with swp and tmp files
" EXPERIMENTAL
" Set persistent undo for vim using tempdir
set undodir=~/tmp/vim
set undofile
#####
# OLD CONFIG
# ===
Pry.commands.alias_command 'x', 'exit'
Pry.commands.alias_command 'wh', 'whereami'
Pry.commands.alias_command 'pl', 'play -l'
Pry.commands.alias_command 'ht', 'hist -T'
Pry.commands.alias_command 'hr', 'hist -r'
Pry.config.editor = proc { |file, line| "vim +#{line} #{file}"}
# == Pry-Nav - Using pry as a debugger ==
def get_rstring(addr):
s = addr.cast(string_t.pointer())
if s['basic']['flags'] & (1 << 13):
return s['as']['heap']['ptr'].string()
else:
return s['as']['ary'].string()
def get_lineno(iseq, pos):
if pos != 0:
pos -= 1
" Hack for speeding up vim load when using rvm
"let g:ruby_path = system('rvm use system')
" Sun Feb 16 21:37:02 EST 2014 - Consider trying 'infect' + pathogen
"=bundle tpope/vim-pathogen
"=bundle tpope/vim-sensible
source ~/.vim/bundle/vim-pathogen/autoload/pathogen.vim
execute pathogen#infect('bundle/{}')
#!/usr/bin/ruby
branch_name = `git rev-parse --abbrev-ref HEAD`.chomp
DIVIDERS = %r{[-|_|/|\/]}
parts = branch_name.match(/(?<initials>.+)#{DIVIDERS}(?<number>\d{3,})#{DIVIDERS}(?<description>.*)/)
begin
INITIALS = parts[:initials].split(DIVIDERS).join("/").upcase
#!/usr/bin/env ruby
branch_name = `git rev-parse --abbrev-ref HEAD`.chomp
DIVIDERS = %r{[-|_|/|\/]}
parts = branch_name.match(/(?<initials>.+)#{DIVIDERS}(?<number>\d{5,})#{DIVIDERS}(?<description>.*)/)
begin
INITIALS = parts[:initials].split(DIVIDERS).join("/").upcase
# TODO:
# - write function to transform jam update to jam upgrade
# Apps
# Port num + 100 reserved for puma control
export COMPANY_PREFIX='RP'
export RP_AG_CONTROL_PORT=9392
export RP_CONFUSION_CONTROL_PORT=9410
export RP_PORTAL_CONTROL_PORT=9411
export RP_RNR_UI_CONTROL_PORT=9413
export RP_SECRET_TOKEN='pumarules'
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select