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 / 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 / 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 / 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 / .mongorc.js
Created January 27, 2014 14:23
Mongorc Pretty Output
Prompt = {
cmdCount: 1,
host: function() {
if(db.serverStatus().ok == false) {
if(db.serverStatus().errmsg == "need to login") {
return "unauthorized";
} else {
return "error"
}
@tekwiz
tekwiz / rmate-setup.sh
Last active January 2, 2016 10:19
Download & setup rmate
#!/usr/bin/env bash
##
# Run with:
#
# curl -sSL https://gist.github.com/tekwiz/8289262/raw/rmate-setup.sh | bash -s
#
mkdir -p ~/bin
curl -Lo ~/bin/rmate https://raw.github.com/textmate/rmate/master/bin/rmate
@tekwiz
tekwiz / git-backup
Created June 3, 2013 21:04
Git Backup
#!/usr/bin/env ruby
require "tmpdir"
require "fileutils"
PWD_ORIG = Dir.pwd
TMP_DIR = Dir.mktmpdir("git-backup")
def remote_basename
if ARGV[0] =~ /\.git$/
@tekwiz
tekwiz / 0-AWS_S3_Snippets.md
Last active December 11, 2015 00:18
S3 Website Bucket Policy
@tekwiz
tekwiz / README.md
Last active December 10, 2015 21:18
Fixer for iWeb problems

IWFixer

The iwfixer.js file contents should be appended at the very bottom of the iWebSite.js script in the iWeb application. This will then become minified with the iWebSite.js file when any iWeb site is published.

Compatibility

This is only known to work with iWeb 3.0; however, only the

@tekwiz
tekwiz / circuit_formats.rb
Created October 2, 2012 17:01
Circuit Formats
module Circuit
FORMAT_EXT_REGEXP = /\.([^\.]+)$/
module Validators
silence_warnings do
SLUG_REGEXP = /\A(?:[-_!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*(?:;(?:[-_!~*'()a-zA-Z\d:@&=+$,]|%[a-fA-F\d]{2})*)*\Z/
end
class SlugValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
class Semaphore
def initialize(limit)
@main, @internal = Mutex.new, Mutex.new
@mutexes = limit.times.collect { Mutex.new }
end
def synchronize
# create the mutex variable for scope
# grab the current thread for sleeping if necessary later
mutex, thread = nil, Thread.current