Skip to content

Instantly share code, notes, and snippets.

View tekwiz's full-sized avatar

Travis D. Warlick, Jr. tekwiz

View GitHub Profile
@tekwiz
tekwiz / strToCodes.coffee
Last active August 29, 2015 14:01 — forked from anonymous/strToCodes.coffee
strToCodes
strToCodes = (str) ->
result = new Array(str.length)
pos = 0
while pos < str.length
c = str.charCodeAt(pos).toString(16)
result[pos] = if c.length % 2 == 1 then "x0"+c else "x"+c
result[pos] += "\n" if c == "a" # i.e. "\n"
pos++
result.join(' ')
@tekwiz
tekwiz / ssh-tunnel
Last active August 29, 2015 14:03
ssh-tunnel command
#!/usr/bin/env ruby
require "optparse"
require "ostruct"
$options = OpenStruct.new
$options.verbose = false
$options.local_port = nil
$opts = OptionParser.new do |o|
@tekwiz
tekwiz / trello-filter.xml
Last active August 29, 2015 14:04
GMail Trello Filter
<?xml version='1.0' encoding='UTF-8' ?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:apps='http://schemas.google.com/apps/2006'>
<title>Mail Filters</title>
<entry>
<category term='filter'></category>
<title>Mail Filter</title>
<content></content>
<apps:property name='from' value='trello.com'/>
@tekwiz
tekwiz / excerpts.nginx.access.log.md
Last active August 29, 2015 14:06
PRNOCv3 failover server tests

blpv0326.enaf.bhdc.att.com: Nginx access.log

98.92.214.10 - - [16/Sep/2014:15:49:20 -0500] "GET / HTTP/1.1" 444 0 "-" "Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53"

blpv0327.enaf.bhdc.att.com: Nginx access.log

98.92.214.10 - - [16/Sep/2014:15:50:33 -0500] "GET / HTTP/1.1" 444 0 "-" "Mozilla/5.0 (iPad; CPU OS 7_1_2 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D257 Safari/9537.53"
@tekwiz
tekwiz / save-fail.md
Created February 9, 2015 18:21
Saving advanced search on Twitter fails
@tekwiz
tekwiz / create_USB-CentOS_6.6.sh
Last active August 29, 2015 14:16
Create CentOS 6.6 Bootable USB Installer
#!/bin/bash
###
# Download the ISO if not already done:
# curl -o ~/Downloads/CentOS-6.6-x86_64-minimal.iso \
# http://mirror.lug.udel.edu/pub/centos/6.6/isos/x86_64/CentOS-6.6-x86_64-minimal.iso
#
# Verify the ISO:
# iso_sha256=` openssl sha256 -r ~/Downloads/CentOS-6.6-x86_64-minimal.iso | cut -d ' ' -f1`
# [[ $iso_sha256 != '5458f357e8a55e3a866dd856896c7e0ac88e7f9220a3dd74c58a3b0acede8e4d' ]] && echo "BAD: SHA256 is incorrect!" 1>&2
@tekwiz
tekwiz / S3Snippets.rb
Created September 2, 2009 16:25
Ruby Snippets for S3
require 'rubygems'
require 'aws/s3'
require 'activesupport'
S3_KEY_ID = ''
S3_ACCESS_KEY = ''
BUCKET = ''
# Connect
AWS::S3::Base.establish_connection!(
@tekwiz
tekwiz / CloudFilesSnippets.rb
Created September 2, 2009 16:29
Ruby Snippets for CloudFiles
require 'rubygems'
require 'cloudfiles'
require 'activesupport'
CF_USERNAME = ''
CF_API_KEY = ''
CONTAINER = ''
# Connect
cf = CloudFiles::Connection.new(CF_USERNAME, CF_API_KEY)
@tekwiz
tekwiz / mate-gem
Created April 25, 2010 18:00
Opens a gem and its direct dependencies in text mate
#!/usr/bin/env ruby
# Opens the source code for a gem and the gem's direct dependencies in textmate.
#
# When this is mature it will be added to [Dionysus](http://github.com/tekwiz/dionysus).
#
# TODO add banner and better docs to option parser
# TODO add --quiet flag to suppress dependency not found warnings
# TODO add recursive dependencies (e.g. failure: `mate-gem rails 3.0.0.beta3` does not load activemodel
# since that is a dependency of activerecord)
state_machine User do
state :new
state :normal
state :locked
end
state_machine Membership do
state :new
state :active
state :inactive