Skip to content

Instantly share code, notes, and snippets.

@keeganwitt
keeganwitt / hdfsDownloader.groovy
Created April 7, 2014 20:20
A Groovy script to download HDFS files in parallel
// Usage: groovy hdfsDownloader.groovy [prod|qa|<dev username>] <file> (<output directory>)
// <file> can be an individual file or a directory of part files.
// If <output directory> is not specified, the current working directory is used
import groovy.json.JsonSlurper
import java.util.concurrent.Executors
import java.util.concurrent.ExecutorService
import java.util.concurrent.TimeUnit
@keeganwitt
keeganwitt / Guild_Wars_Tonic_Bot.ahk
Created August 29, 2011 15:15
An AutoHotkey tonic bot for Guild Wars
; Author: Keegan Witt
; Last Updated: 18 Jan 2011
; Adapted from http://www.autohotkey.com/forum/topic55918.html
#NoEnv
#WinActivateForce
SendMode Input
MsgBox, 0, GW Tonic Bot, You can press Ctrl-Q anytime to quit
@keeganwitt
keeganwitt / AutoClicker.ahk
Created August 29, 2011 15:13
A generic autoclicker AutoHotkey program
; Author: Keegan Witt
; Last Updated: 18 Jan 2011
#NoEnv
#WinActivateForce
hours := 0
minutes := 0
seconds := 0
@keeganwitt
keeganwitt / Guild_Wars_Drunkard_Bot.ahk
Last active September 27, 2015 00:58
An AutoHotkey bot to maintain the optimum level of drunkenness for the drunkard title in Guild Wars.
; Author: Keegan Witt
; Last Updated: 18 Jan 2011
; Adapted from http://www.autohotkey.com/forum/topic22611-30.html
#NoEnv
#WinActivateForce
SendMode Input
MsgBox, 0, GW Drunkard Bot, You can press Ctrl-Q anytime to quit
@keeganwitt
keeganwitt / viewvc-link-log-view.user.js
Created September 1, 2011 16:53
A userscript to add links to log view for directories in ViewVC.
@keeganwitt
keeganwitt / launchRis.bat
Last active September 29, 2015 02:08
Deletes temp file that prevents RIS 2.0 from launching correctly on newer versions of Windows then launches RIS 2.0
@echo off
rem Author: Keegan Witt
rem Description: Deletes temp file that prevents RIS 2.0 from launching correctly on newer versions of Windows then launches RIS 2.0
del "%TEMP%\Ris 2.0.mov.#res"
if %PROCESSOR_ARCHITECTURE% == x86 (
"%PROGRAMFILES%\LEGO MINDSTORMS\RIS 2.0\LaunchRis2.exe"
) else (
"%PROGRAMFILES(X86)%\LEGO MINDSTORMS\RIS 2.0\LaunchRis2.exe"
@keeganwitt
keeganwitt / GuildWarsImage.bat
Last active September 29, 2015 09:38
Launches Guild Wars with the -image option
@echo off
rem Author: Keegan Witt
rem Version 1.0
rem This runs Guild Wars with the -image argument, which downloads all the updated files.
rem if Guild Wars is running, kill it
TASKKILL /F /IM "gw.exe" 2> NUL
rem launch Guild Wars with the -image option
if %PROCESSOR_ARCHITECTURE% == x86 (
@keeganwitt
keeganwitt / mercurial-stay-on-tip.user.js
Created May 15, 2012 17:15
A userscript to change links to tip version in Mercurial web interface if you are navigating from the tip version.
// ==UserScript==
// @name mercurial-stay-on-tip
// @version 0.1
// @description Provide changes links to tip version in Mercurial web interface if you are navigating from the tip version.
// @author Keegan Witt
// @include http://hg.openjdk.java.net/*
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
function addJQuery(callback) {
@keeganwitt
keeganwitt / GenerateJavaOnixTagConverter.groovy
Created May 29, 2012 18:58
A Groovy script to generate Java source files to convert between ONIX short and reference tags
/**
* @author Keegan Witt
* @version 1.0
*/
class GenerateJavaOnixTagConverter {
private static final String SCHEMA_2_FILENAME = "ONIX_BookProduct_Release2.1_reference.xsd"
private static final String SCHEMA_3_FILENAME = "ONIX_BookProduct_3.0_reference.xsd"
private static final String ONIX_2_CLASS = "Onix2TagConverter"
private static final String ONIX_3_CLASS = "Onix3TagConverter"
@keeganwitt
keeganwitt / SleepInputFormat.java
Last active December 20, 2015 02:09
SleepInputFormat to trick Hadoop into thinking there's input to process, when really there's not (useful in little test jobs)
/**
* This is a lot like the InputFormat defined in Hadoop's
* <a href="https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.22/mapreduce/src/test/mapred/org/apache/hadoop/mapreduce/SleepJob.java">SleepJob</a>
* except that it uses the Hadoop 2 API.
*/
public static class SleepInputFormat extends InputFormat<IntWritable, IntWritable> {
public static final String MAP_SLEEP_COUNT = "mapreduce.sleepjob.map.sleep.count";
public static final String REDUCE_SLEEP_COUNT = "mapreduce.sleepjob.reduce.sleep.count";
@Override