Skip to content

Instantly share code, notes, and snippets.

@turing85
turing85 / Dockerfile
Last active October 29, 2023 23:40
Multistage dockerfile to install software into an UBI micro image
ARG MICRODIR=/microdir
ARG PACKAGES_TO_INSTALL="java-17-openjdk-devel"
FROM registry.access.redhat.com/ubi8-micro@sha256:eb4245271537034f69ee336a4a2b31d3fbae4048ec1db53ff89de749c35cf537 AS BASE
FROM registry.access.redhat.com/ubi8@sha256:83c0e63f5efb64cba26be647e93bf036b8d88b774f0726936c1b956424b1abf6 AS BUILD
ARG MICRODIR
ARG PACKAGES_TO_INSTALL
RUN mkdir ${MICRODIR}
COPY --from=BASE / ${MICRODIR}
@turing85
turing85 / gist:4acfa561e3f8eff640ad0834a892db3a
Last active January 21, 2023 01:47
so-75190415-docker-compose
services:
frontend:
container_name: frontend
build:
context: ../
dockerfile: docker/base.dockerfile
target: frontend
args:
#!/usr/bin/env bash
shorten() {
if [[ -z ${1} ]]; then
echo "Please pass the string to split as 1st argument"
exit 1
fi;
text="${1}"
if [[ -z ${2} ]]; then
@Override
protected void doStart() throws Exception {
super.doStart();
transactionTemplate.execute(new TransactionCallback<Boolean>() {
@Override
public Boolean doInTransaction(TransactionStatus status) {
Savepoint savepoint = status.createSavepoint():
try {
// we will receive an exception if the table doesn't exists or we cannot access it
MERGE INTO some_table AS saved
USING (
VALUES (?, ?, ?, CURRENT_TIMESTAMP)
) AS param (
servicename,
processorname,
messageId,
createdat
)
ON (
#!/usr/bin/env bash
set -e
function print_git_tree() {
git log \
--graph \
--no-color \
--source \
--all \
--max-count=5 \
@turing85
turing85 / get_and_decode_access_token
Last active July 8, 2023 12:10
Get and decode access token from token endpoint
#!/usr/bin/env bash
set -e
shopt -s inherit_errexit
function die() {
if [[ -n "${1}" ]]
then
>&2 echo "${1}"
fi
exit "${2:-1}"
@turing85
turing85 / clean_all_maven_projects.sh
Last active July 11, 2023 18:33
clean all maven projects
#!/usr/bin/env bash
echo "finding all poms"
readarray -t poms < <(find "${1:-${MVN_CLEAN_ROOT}}" -name "pom.xml" || true)
echo "found ${#poms[@]} poms."
echo "deduping poms"
projects_to_clean=()
for pom in "${poms[@]}"
do
@turing85
turing85 / increment.sh
Last active September 22, 2023 22:45
increment versions
function next_release_version() {
local current_version="${1}"
local first_part
first_part=$(echo "${current_version}" | sed -e 's/^\(.*\)\([[:digit:]]\+\)[^\.]*$/\1/g')
local last_digit
last_digit=$(echo "${current_version}" | sed -e 's/^\(.*\)\([[:digit:]]\+\)[^\.]*$/\2/g')
echo "${first_part}$((last_digit+1))"
}
function next_snapshot_version() {
@turing85
turing85 / main.go
Last active November 13, 2023 22:27
golang fyne example
package main
import (
"fmt"
"time"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/data/binding"