Skip to content

Instantly share code, notes, and snippets.

Avatar

Keegan Witt keeganwitt

View GitHub Profile
@keeganwitt
keeganwitt / gradle-dependency-analyze.gradle
Created Jan 31, 2018 — forked from kellyrob99/gradle-dependency-analyze.gradle
A simple Gradle wrapper for the maven dependency:analyze goal
View gradle-dependency-analyze.gradle
import org.apache.maven.shared.dependency.analyzer.ClassAnalyzer
import org.apache.maven.shared.dependency.analyzer.DefaultClassAnalyzer
import org.apache.maven.shared.dependency.analyzer.DependencyAnalyzer
import org.apache.maven.shared.dependency.analyzer.ProjectDependencyAnalysis
import org.apache.maven.shared.dependency.analyzer.asm.ASMDependencyAnalyzer
import org.gradle.api.Project
import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.artifacts.ResolvedArtifact
import org.gradle.api.artifacts.ResolvedDependency
@keeganwitt
keeganwitt / dependency-report.gradle
Created Jan 31, 2018 — forked from tzachz/dependency-report.gradle
Gradle: multi-project dependency graph (supports depth > 2)
View dependency-report.gradle
// Inspired by https://gist.github.com/abesto/cdcdd38263eacf1cbb51
// Task creates a .dot file with all inter-module dependencies
// Supports any depth of nested modules
task moduleDependencyReport {
doLast {
def file = new File("project-dependencies.dot")
file.delete()
file << "digraph {\n"
file << "splines=ortho\n"
@keeganwitt
keeganwitt / pom.xml
Last active Mar 8, 2019
Groovyc via Maven AntRun Example
View pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovyc-antrun-example</artifactId>
<name>Groovyc Maven AntRun Example</name>
<version>1.0-SNAPSHOT</version>
@keeganwitt
keeganwitt / hdfsDownloader.groovy
Created Apr 7, 2014
A Groovy script to download HDFS files in parallel
View hdfsDownloader.groovy
// 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 / hdfs-username-hack.user.js
Created Oct 3, 2013
A userscript to override the username to allow you to view HDFS files and directories from the NameNode web interface that aren't world readable
View hdfs-username-hack.user.js
// ==UserScript==
// @name hdfs-username-hack
// @version 0.1
// @description Overrides the username to allow you to view HDFS files and directories from the NameNode web interface that aren't world readable
// @author Keegan Witt
// @include */browseDirectory.jsp*
// @include */browseBlock.jsp*
// ==/UserScript==
// a function that loads jQuery and calls a callback function when jQuery has finished loading
@keeganwitt
keeganwitt / SleepInputFormat.java
Last active Dec 20, 2015
SleepInputFormat to trick Hadoop into thinking there's input to process, when really there's not (useful in little test jobs)
View SleepInputFormat.java
/**
* 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
@keeganwitt
keeganwitt / GenerateJavaOnixTagConverter.groovy
Created May 29, 2012
A Groovy script to generate Java source files to convert between ONIX short and reference tags
View GenerateJavaOnixTagConverter.groovy
/**
* @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 / mercurial-stay-on-tip.user.js
Created May 15, 2012
A userscript to change links to tip version in Mercurial web interface if you are navigating from the tip version.
View mercurial-stay-on-tip.user.js
// ==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 / GuildWarsImage.bat
Last active Sep 29, 2015
Launches Guild Wars with the -image option
View GuildWarsImage.bat
@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 / launchRis.bat
Last active Sep 29, 2015
Deletes temp file that prevents RIS 2.0 from launching correctly on newer versions of Windows then launches RIS 2.0
View launchRis.bat
@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"