Skip to content

Instantly share code, notes, and snippets.

gabrielbauman / Dockerfile
Last active Dec 13, 2020
Multi-stage docker build for Java/Maven apps
View Dockerfile
# Cache maven dependencies as an intermediate docker image
# (This only happens when pom.xml changes or you clear your docker image cache)
FROM maven:3-adoptopenjdk-15 as dependencies
COPY pom.xml /build/
WORKDIR /build/
RUN mvn --batch-mode dependency:go-offline dependency:resolve-plugins
# Build the app using Maven and the cached dependencies
# (This only happens when your source code changes or you clear your docker image cache)
# Should work offline, but
gabrielbauman /
Created Jul 10, 2019
A very simple (but useful) method of getting basic finite state machine behaviour using a Java enum.
package com.gabrielbauman.gist;
import java.util.Arrays;
* A very simple (but useful) method of getting basic finite state machine behaviour using a Java enum.
* <code>
* EnumStateMachine state = NEUTRAL;
* state = state.transitionTo(FIRST);
gabrielbauman /
Created Nov 15, 2017 — forked from aldur/

Root OnePlus5 without unlocking the bootloader

Gain adb root.

$ adb shell am start -n --es "code" "angela"

Download Magisk-v14.0 and extract it somewhere. Download MagiskManager.


Keybase proof

I hereby claim:

  • I am GabrielBauman on github.
  • I am gabrielbauman ( on keybase.
  • I have a public key whose fingerprint is 85C7 1A0E E159 9F31 F7BF 9142 A868 647F BD24 2F13

To claim this, I am signing this object:

gabrielbauman /
Last active Dec 30, 2021
A Java enum representing credit card types (Visa, Mastercard etc) that can detect card type from a credit card number.
package com.gabrielbauman.gist;
import java.util.regex.Pattern;
public enum CardType {
gabrielbauman /
Created May 16, 2014
Openshift's haproxy hits '/' every 2 seconds with a null user agent to see if your scalable app is up. If "/" does not respond with a 200 OK, haproxy marks the server as down even if it's actually up. This filter generates an empty 200 OK when it detects a haproxy ping..
package com.gabrielbauman.gists;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebFilter(urlPatterns = "/")
public class OpenshiftHaproxyFilter implements Filter {
gabrielbauman /
Created Mar 10, 2014
Run this whenever your IP changes to tell about your new address. Fixes weird Netflix "internal errors", the Roku android app not signing in properly, and other glitchiness.
# Set this to the email address you use with
curl \
--url \
--form "validated=1&email=${UNBLOCKUS_EMAIL}&rid=0" \
--user-agent "Mozilla/5.0 (X11; Linux x86_64; rv:27.0) Gecko/20100101 Fi27.0" -q \
&> /dev/null
gabrielbauman / litecoin_balance
Created Dec 12, 2013
Quick, dumb script that outputs the balance of a Litecoin address.
View litecoin_balance
# Check the balance of a Litecoin address by querying
# Drop this into /usr/local/bin and make it executable.
# Needs curl.
# Helpful? LWSHbKEHT18WX93zrSjBhc1AnxC4UCmbCt
if [ "$#" -ne 1 ]; then echo "Usage: litecoin_balance LTC_ADDRESS"; exit 1; fi;
gabrielbauman / gist:5689446
Created Jun 1, 2013
A Maven profile that detects when the build is running on Heroku.
View gist:5689446
<!-- Do Heroku-specific stuff here -->