Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am jgworks on github.
  • I am jgworks (https://keybase.io/jgworks) on keybase.
  • I have a public key whose fingerprint is CFEC 9AAB F5D3 9C29 DD09 474F 97F4 A8D3 168B D5A3

To claim this, I am signing this object:

@jgworks
jgworks / render_template.rb
Created September 2, 2014 15:38
Render ERB template based on provided environment
#!/usr/bin/env ruby
require 'ERB'
require 'YAML'
require 'hash_deep_merge'
class Template
def evaluate
set_resource_variables
#!/usr/bin/env python
#
# Reads from standard input, dumps it onto a Confluence page
# You'll need to modify the URL/username/password/spacekey/page title
# below, because I'm too lazy to bother with argv.
import sys
import ssl
from xmlrpclib import Server
def update_page(username, pw):
#!/usr/bin/env python
# Example output:
# $ python gistfile1.py --max-prefix=23
# {'children': [{'children': [{'name': '10.100.0.0/23'},
# {'name': '10.100.2.0/23'}],
# 'name': '10.100.0.0/22'},
# {'children': [{'name': '10.100.4.0/23'},
# {'name': '10.100.6.0/23'}],
# 'name': '10.100.4.0/22'}],
@jgworks
jgworks / local_envsetup.sh
Created January 7, 2012 04:33
Envsetup for android
#!/bin/bash
export JAVA_HOME=~/jdk1.6.0_29
JAVA_PATH_SET=$(echo $PATH | tr ':' '\n' | grep "$JAVA_HOME/bin" | wc -l)
if [ $JAVA_PATH_SET -eq 0 ]; then
export PATH=$JAVA_HOME/bin:$PATH
fi
export USE_CCACHE=1
export CCACHE_DIR=/media/VMs/ccache
prebuilt/linux-x86/ccache/ccache -M 50G
@jgworks
jgworks / tldcheck.sh
Created January 13, 2012 13:47
Download and keep track of TLDs
#!/bin/bash
OUTFILE="tlds-$(date +%F).txt"
LAST_TLD=$(ls -rt tlds-* | tail -1)
curl -sS "http://data.iana.org/TLD/tlds-alpha-by-domain.txt" -o $OUTFILE
diff -u $LAST_TLD $OUTFILE
@jgworks
jgworks / snapshot
Created May 21, 2012 14:42
btrfs snapshot creation script
#!/bin/bash
if [[ "$1" == "" ]]; then
echo usage: $(basename $0) '<path>'
echo
echo options:
echo ' -r create a read-only snapshot'
echo
exit 1
fi
@jgworks
jgworks / mcsnapshot.ps1
Created October 15, 2012 23:36
Get latest minecraft snapshot
$mcassets = "http://assets.minecraft.net/"
[xml]$mc = (New-Object System.Net.WebClient).DownloadString($mcassets)
$latest = $mc.listbucketresult.contents | sort 'lastmodified' | select-object -last 1
$latest | get-member
echo ''
echo $mcassets$latest.key
@jgworks
jgworks / gist:3946975
Created October 24, 2012 16:04
Random Bash Code
# set DIR to location of this file
DIR=$(cd "$(dirname "$0")"; pwd)
" copy all this into a vim buffer, save it, then...
" source the file by typing :so %
" Now the vim buffer acts like a specialized application for mastering vim
" There are two queues, Study and Known. Depending how confident you feel
" about the item you are currently learning, you can move it down several
" positions, all the way to the end of the Study queue, or to the Known
" queue.
" type ,, (that's comma comma)