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 / 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 / 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 / .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 / 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
#!/bin/bash
group_name='<log-group-name>'
start_seconds_ago=3600
aws_cmd_opts= # e.g. "--profile <profile-name>"
# Usage: get_loglines "<log-group-name>" <start-time>
get_loglines() {
aws $aws_cmd_opts --output text logs filter-log-events \
--log-group-name "$1" \