Skip to content

Instantly share code, notes, and snippets.

View schnatterer's full-sized avatar

schnatterer

View GitHub Profile
@schnatterer
schnatterer / log4j.properties
Created April 17, 2013 17:40
log4j: Write Hibernate's SQL statments to a specific logfile (without additional framework)
log4j.rootLogger=INFO, File, Console
log4j.logger.my.application=DEBUG, File
log4j.logger.org.hibernate=WARN, File, Console
log4j.additivity.org.hibernate.SQL=false
log4j.logger.org.hibernate.SQL=DEBUG, FileSql
log4j.additivity.org.hibernate.SQL=false
log4j.logger.org.hibernate.type=TRACE, FileSql
log4j.additivity.org.hibernate.type=false
@schnatterer
schnatterer / angular-dynamic-locale - preload locales in gulp build.md
Last active July 21, 2016 08:34
angular-dynamic-locale - preload locales in gulp build

lgalfaso/angular-dynamic-locale#93 provides a solution for packaging angular locales with lgalfaso/angular-dynamic-locale during the build. Here's a more elaborate example using gulp.

Important steps

  • Adapt gulp build (see gulpfile.js, don't forget to add gult/temp/dynamicLocalePreload.js to your test runner (e.g. karma.conf.js)
  • Add dependency to dynamicLocalePreload (see yourApp.js), don't forget to remove any calls to tmhDynamicLocaleProvider.localeLocationPattern() from your code.
@schnatterer
schnatterer / LibraryProjectTestRunner.java
Last active October 15, 2016 12:50 — forked from venator85/LibraryProjectTestRunner.java
A Robolectric test runner for library projects compatible with Android Gradle plugin 2.2.0-alpha6 and later
import org.junit.runners.model.InitializationError;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;
import org.robolectric.internal.bytecode.InstrumentationConfiguration;
import org.robolectric.manifest.AndroidManifest;
import org.robolectric.res.FileFsFile;
import org.robolectric.res.FsFile;
public class LibraryProjectTestRunner extends RobolectricTestRunner {

Keybase proof

I hereby claim:

  • I am schnatterer on github.
  • I am schnatterer (https://keybase.io/schnatterer) on keybase.
  • I have a public key ASDrChtftNWrAPKW6Gma1_Wl5MZEO_3dDADZqj-zsoNC3wo

To claim this, I am signing this object:

@schnatterer
schnatterer / deleteGcrImages.sh
Last active October 8, 2019 09:17
Deletes all images of a Google Container Registry Repo
#!/usr/bin/env bash
set -o nounset -o pipefail -o errexit
function main() {
ROOT_REPO="${1}"
local count=0
for REPO in $(gcloud container images list --repository=${ROOT_REPO} --limit=999999 | tail -n +2); do
for IMAGE in $(gcloud container images list --repository=${REPO} --limit=999999 | tail -n +2); do
for DIGEST in $(gcloud container images list-tags "${IMAGE}" --limit=999999 --format='get(digest)'); do
@schnatterer
schnatterer / jdk-version-from-builder.sh
Last active November 18, 2020 20:46
Find out the JRE version for a specific builder image version when using Cloud Native Buildpacks
BUILDER_VERSION=base-platform-api-0.3
JDK_MAJOR_VERSION=11
BUILDPACK=paketo-buildpacks/bellsoft-liberica
BUILDER_IMAGE="gcr.io/paketo-buildpacks/builder:${BUILDER_VERSION}"
JQ_PARSE_BUILDPACK_VERSION=".Labels[\"io.buildpacks.buildpack.layers\"] | fromjson | .[\"${BUILDPACK}\"] | keys[0]"
if command -v skopeo; then
# Skopeo does not need to pull the image, so its much faster when the image is not present locally
@schnatterer
schnatterer / create-sudo-kubeconfig.sh
Last active December 17, 2020 12:23
Create a "sudo" kubeconfig for the current kubecontext
#!/usr/bin/env bash
if [[ ! -z "${DEBUG}" ]]; then set -x; fi
set -o errexit -o nounset -o pipefail
# Creates a sudo kubeconfig for the current context
# Result is either printed to stdout or added to current KUBECONFIG (queried interactively)
#
# Options can be passed via env vars:
# * SUDO_PREFIX - Prefix added to current kubecontext and user to flag it as "sudo". Default: SUDO-
# * SUDO_CONTEXT_POSTFIX - Postfix added to current kubecontext to raise attention to it being for sudo only. Default: -:-O
@schnatterer
schnatterer / README.md
Created November 12, 2021 21:00
Restore android call logs

Restoring android call logs backed up via myPhoneExplorer (unable to restore with Android 11) using a different app (Phone Backup and Restore).

  • Export all call logs from myPhoneExplorer as CSV (Tested with version 1.9.0)
  • Check out mpe-csv-2-json.js and package.json from this gist
  • npm install
  • ./mpe-csv-2-json.js your.csv > 2021-10-24, 09:02:25.sbl
  • Copy the .sbl file to where "Phone Backup and Restore" can read it. In Version 1.6.6 it's /storage/emulated/0/Android/data/com.phone.backup.restore/files/ (which requires root to access :-/)
  • Open Backup and restore app and restore your call logs file
@schnatterer
schnatterer / trivy-operator-grafana.json
Last active January 16, 2023 14:28
Grafana Dashboard for Trivy Operator
{
"annotations": {
"list": [
{
"$$hashKey": "object:7",
"builtIn": 1,
"datasource": {
"type": "datasource",
"uid": "grafana"
},
@schnatterer
schnatterer / boot-img.sh
Last active January 4, 2023 21:03
Download CalyxOS boot.img for more convenient rooting
#!/usr/bin/env bash
set -o errexit -o nounset -o pipefail
# Download lastest Calyx factory image and extract boot.img to be patched via magisk
# See here for device names: https://calyxos.org/install/
DEVICE=oriole
CHANNEL=stable4
DEST_DIR=/storage/emulated/0/Download