Skip to content

Instantly share code, notes, and snippets.

View corneil's full-sized avatar

Corneil du Plessis corneil

View GitHub Profile
@corneil
corneil / AssertionUtils.java
Created September 3, 2025 11:38
Utility for determining if JVM is running assertions enabled.
public class AssertionUtils {
public static boolean assertionsEnabled = false;
static {
// When this class is loaded the static block will execute and it the application is running with -ea the value of assertionsEnabled will be set to true.
//noinspection AssertWithSideEffects
assert (assertionsEnabled = true);
}
}
alias mcist="./mvnw clean install -DskipTests -T 1C"
alias mt="./mvnw test"
alias md="./mvnw dependency:tree"
alias gc="./gradlew clean"
alias gb="./gradlew build"
alias gcb="./gradlew clean build"
alias gch="./gradlew check"
#!/bin/bash
set +e
brew doctor
RC=$?
if ((RC>0); then
echo "Installing: Homebrew"
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
test -d ~/.linuxbrew && eval "$(~/.linuxbrew/bin/brew shellenv)"
test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> ~/.bashrc
@corneil
corneil / sdk-java.sh
Last active January 31, 2024 18:40
Easily select java version and distribution with sdkman
#!/bin/bash
function sdkj() {
if [ "$1" == "" ]; then
echo "Expected Version prefix"
exit 1
fi
PREFIX=$1
CONTAINS=$2
# list candidates in the order they were installed. Last matching installed will be selected.
CANDIDATES=$(ls -tr ~/.sdkman/candidates/java/)
@corneil
corneil / README.md
Last active March 24, 2023 11:54
Importing one git project into another.

If you want to import one project into another and the resulting project will be a subfolder into the parent the following steps will allow you preserve history and tags.

The tags from sub-project are prefixed as part of the process.

The scripts assume the 2 projects are on disk with the same parent folder.

Be careful on the merged project because some of the historical commits only reference the sub project and branching from the wrong sha can cause confusion.

@corneil
corneil / build-modified-modules.sh
Last active January 19, 2023 11:10
Determine changed modules in multi-module Maven Project in GitHub Actions
#!/bin/bash
function itemInModules() {
local e
for e in ${MODULES}; do
if [[ "$e" == "$ITEM" ]]; then
echo "1"
return 0
fi
done
echo "0"

Keybase proof

I hereby claim:

  • I am corneil on github.
  • I am corneil (https://keybase.io/corneil) on keybase.
  • I have a public key ASCoDAx2zqO9T5p7T7GGgSjEh3jFmUzdzUomM-tVbgeg_Qo

To claim this, I am signing this object:

@corneil
corneil / simple-json.sh
Created October 26, 2022 11:37
Prepare JSON for saving in ENV.
jq -c . $1
@corneil
corneil / mvn-get-version.sh
Last active October 26, 2022 11:38
Shell script to extract Maven project version for use in CI tools.
#!/usr/bin/env bash
VERSIONS=$($SCDIR/mvnw exec:exec -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive -q | sed 's/\"//g' | sed 's/version=//g')
for v in $VERSIONS; do
VERSION=$v
done
echo "$VERSION"
@corneil
corneil / find_table_col.sql
Created September 3, 2021 05:53
Find a DB2 table name and column from SQLCODE=-407, SQLSTATE=23502
SELECT C.TABSCHEMA, C.TABNAME, C.COLNAME
FROM SYSCAT.TABLES AS T, SYSCAT.COLUMNS AS C
WHERE T.TBSPACEID = -- TBSPACEID
AND T.TABLEID = -- TABLEID
AND C.COLNO = -- COLNO
AND C.TABSCHEMA = T.TABSCHEMA
AND C.TABNAME = T.TABNAME