Skip to content

Instantly share code, notes, and snippets.

View gabetax's full-sized avatar

Gabe Martin-Dempesy gabetax

  • Zendesk
  • San Francisco
  • 17:12 (UTC -07:00)
View GitHub Profile
@gabetax
gabetax / example.html
Created January 30, 2012 05:42
XHTML to Markdown XSLT Translation
<html>
<body>
<h1>Our Navigation</h1>
<p>I'm writing an example xhtml document to get converted into markdown!</p>
<h2>Examples</h2>
<h3>Text formatting</h3>
<p>Sometimes with longer <em>paragraphs</em><br/>we just want a new line <strong>immediately</strong>.</p>
<div>Divs are block elements too, and people don't always put their text in p tags.</div>
@gabetax
gabetax / gist:4074023
Created November 14, 2012 19:01
OTP key reuse vulnerability cracker
class String
# 'hello' ^ ' ' => 'HELLO'
def ^ s2
to_byte_array.zip(s2.to_byte_array).map { |s| s[0] ^ s[1] if s[1] }.reject(&:nil?).pack('C*')
end
# '68656c6c6f20776f726c64' => 'hello world'
def hex_string_to_binary_string
[self].pack 'H*'
end
@gabetax
gabetax / .vimrc.colemak
Created March 1, 2022 18:36
Minimal Colemak remapping for vim navigation
" lowers
noremap n j
noremap e k
noremap i l
noremap j e
noremap l u
noremap u i
noremap k n
#!/bin/sh
# MIS Firewall Script v1.0
#
# Author: gabe@mudbuginfo.com
# Based on O'reilly Linux Server Hacks, #45
#
# Documentation forthcoming
# This script must be run after a boot, as iptables does not save its state
#
#< I. Configuration Options >###################################################
@gabetax
gabetax / states-hate.dot
Created January 21, 2020 01:01
Which states hate each other, graphviz dependency digraph
// data from https://www.reddit.com/r/MapPorn/comments/eq52ce/every_states_least_favorite_state_according_to_my/
digraph G {
"Alabama" -> "Florida"
"Alaska" -> "Texas"
"Arizona" -> "California"
"Arkansas" -> "Alabama"
"California" -> "Texas"
"Colorado" -> "California"
"Connecticut" -> "New Jersey"
@gabetax
gabetax / keybase.md
Created May 16, 2019 20:21
keybase.md

Keybase proof

I hereby claim:

  • I am gabetax on github.
  • I am gabetax (https://keybase.io/gabetax) on keybase.
  • I have a public key whose fingerprint is 1EFD 47AF EC3D 547B A20D 9E55 BF32 3A32 8D07 3EFA

To claim this, I am signing this object:

@gabetax
gabetax / consul travis.yml
Created June 10, 2015 21:11
Consul support on Travis-CI
sudo: false
env:
global:
- CONSUL_VERSION=0.5.0
- CONSUL_DC=dev1
- CONSUL_DIR=$HOME/consul_$CONSUL_VERSION
before_script:
- 'if [[ ! -f $CONSUL_DIR/consul ]]; then (mkdir -p $CONSUL_DIR && cd $CONSUL_DIR && wget https://dl.bintray.com/mitchellh/consul/${CONSUL_VERSION}_linux_amd64.zip && unzip ${CONSUL_VERSION}_linux_amd64.zip); fi'
- $CONSUL_DIR/consul --version
- $CONSUL_DIR/consul agent -server -bootstrap-expect 1 -data-dir /tmp/consul -dc=$CONSUL_DC &
@gabetax
gabetax / geekcode.sig
Last active April 2, 2016 17:22
My geek code from 1999
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GCS/S/M d--(!) s:>:+++ a--- C++++>$ UBL++++ P+>++ L++++ E--- W++ N+ o?
K++ w@ !O M !V PS+++ PE@ Y(+) PGP(+)>+++ t+@ 5 X++ R>+ tv++>! b DI+ D++
G+ e>++ h- r*>+ y?>$
------END GEEK CODE BLOCK------
@gabetax
gabetax / resque_redis_keys.md
Created March 17, 2016 23:20
Keys Resque manages in Redis

Resque Redis keys:

  • resque:workers => SET of "host:pid:raw,queue,list" strings
  • resque:worker:host:pid:raw,queue,list => STRING JSON of job payload for a running worker. Set by #working_on.
  • resque:worker:host:pid:raw,queue,list:started => STRING timestamp when worker booted. Static.
  • resque:stat:failed:host:pid:raw,queue,list => STRING count of failed jobs
  • resque:stat:processed:host:pid:raw,queue,list => STRING count of successful? jobs
@gabetax
gabetax / as_callbacks_logging.rb
Created February 12, 2016 22:19
Log which callback is being run before running it
ActiveSupport::Callbacks::Callback
class ActiveSupport::Callbacks::Callback
def start(key=nil, object=nil)
return if key && !object.send("_one_time_conditions_valid_#{@callback_id}?")
# options[0] is the compiled form of supplied conditions
# options[1] is the "end" for the conditional
#
case @kind
when :before