Skip to content

Instantly share code, notes, and snippets.

View akutz's full-sized avatar

Andrew Kutz akutz

View GitHub Profile
-----------------------------------com.example.ResponseObject.java-----------------------------------
package com.example;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
-----------------------------------com.example.Example.java-----------------------------------
package com.example;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonInclude;
-----------------------------------com.example.Credential.java-----------------------------------
package com.example;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Generated;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonInclude;
@akutz
akutz / gist:5151745
Created March 13, 2013 12:47
A performant way of testing enum membership and parsing an enum from text.
public enum FuBar
{
ONE("one"),
TWO("two");
private static final String PATT;
private static final Map<String,FuBar> MAP;
static
@akutz
akutz / gist:5327309
Created April 6, 2013 19:27
Prints the amount of memory your kexts are using.
echo "Index Refs Address Size Wired Name (Version) <Linked Against>"; \
kextstat -l | \
awk '{ printf "%-6s %-5s %-18s %-10d %-10d %-40s\n", $1, $2, $3, $4, $5, $6}' | \
awk '{ printf "%-6s %-5s %-18s %-10d %-10d %-40s\n", $1, $2, $3, (($4/1024)), (($4/1024)), $6}' | \
sort -rn -k4
@akutz
akutz / .profile
Last active August 29, 2015 14:02
Bash profile functions for managing local instances of Atlassian servers such as JIRA and Stash
# Stash
export STASH_HOME="$HOME/.stash"
export STASH_VERSION="3.0.4"
export STASH_CATALINA_HOME="$HOME/Servers/stash/$STASH_VERSION"
# Jira
export JIRA_HOME="$HOME/.jira"
export JIRA_VERSION="6.2.7"
export JIRA_CATALINA_HOME="$HOME/Servers/jira/$JIRA_VERSION"
@akutz
akutz / headless-chrome
Created March 26, 2015 20:56
A script for running Chrome headless with Xvfb that properly kills child processes
#!/bin/sh
# The path to the chrome binary
CHROME_BINARY=/opt/google/chrome/chrome
# As long as this is set to 1 the script will
# block at the end
RUNNING=1
get_chrome_binary_pid ()
@akutz
akutz / gist:a9fa4c23f928c7fe1213
Created May 26, 2015 00:08
Austin Memorial Day Flood Part Deux
https://www.flickr.com/gp/akutz/E5Ri8e
@akutz
akutz / varset.bash
Last active September 25, 2015 20:36
varsety
#!/bin/bash
# flag for debug logging
DEBUG=true
# store the args passed to this script, just in case
ARGS=$@
# mark this build with an epoch. this is also the only place in the
# file where it's necessary to use a subshell
@akutz
akutz / Makefile
Created September 25, 2015 20:30
A makefile example
STAT_FILE_SIZE = stat --format '%s' $$FILE 2> /dev/null || stat -f '%z' $$FILE 2> /dev/null
CALC_FILE_SIZE := BYTES=$$($(STAT_FILE_SIZE)); SIZE=$$(($$BYTES / 1024 / 1024)); printf "$${SIZE}MB"
PRINT_FILE_SIZE := $(STAT_FILE_SIZE) $(CALC_FILE_SIZE)
MAX_PAD := 80
STATUS_DELIM := ....................................................................................................
START_STATUS = export FILE=$(1); export PAD_LEN=$$(($(MAX_PAD) - $${\#FILE})); printf "$$FILE"
PRINT_STATUS = export EC=$$?; cd $(_); if [ "$$EC" -eq "0" ]; then printf "%*.*s%s\n" 0 $$PAD_LEN "$(STATUS_DELIM)" "SUCCESS!"; else exit $$EC; fi
PARSE_RESULT = export EC=$$?; cd $(_); if [ "$$EC" -ne "0" ]; then exit $$EC; fi
GET_GOOS = $(shell echo $(1) | tr A-Z a-z)