Skip to content

Instantly share code, notes, and snippets.

kekru / add CA cert on CentOS Debian
Last active Oct 29, 2020
Add CA cert to local trust store on CentOS, Debian or Ubuntu
View add CA cert on CentOS Debian
  • Open a webpage that uses the CA with Firefox
  • Click the lock-icon in the addressbar -> show information -> show certificate
  • the certificate viewer will open
  • click details and choose the certificate of the certificate-chain, you want to import to CentOS
  • click "Export..." and save it as .crt file
  • Copy the .crt file to /etc/pki/ca-trust/source/anchors on your CentOS machine
  • run update-ca-trust extract
  • test it with wget
kekru / Docker connect to remote
Last active Oct 26, 2020
Connect to another host with your docker client, without modifying your local Docker installation
View Docker connect to remote

Run commands on remote Docker host

This is how to connect to another host with your docker client, without modifying your local Docker installation or when you don't have a local Docker installation.

Enable Docker Remote API

First be sure to enable the Docker Remote API on the remote host.

This can easily be done with a container.
For HTTP connection use jarkt/docker-remote-api.

kekru /
Last active Oct 22, 2020
Disable Windows Default Error Sound

Disable Windows Error Sound

This is how to disable the default Windows error sound, which occurs, for example, when you search something in a browser and there is no result, or when you type something wrong in a terminal.

I tested this on a german Windows installation, so I'm not sure if my english translations are the correct ones.

  • Search in Windows for "Sound settings" (German: "Soundeinstellungen")
  • Click on "Sound-Control-Panel" (German "Sound-Systemsteuerung")
  • Choose "Sounds" tab
  • Look for "Default Sound - Warning Signal" (or something related, in german it is "Standardton Warnsignal")
kekru /
Last active Oct 22, 2020
nginx TLS SNI routing, based on subdomain pattern

Nginx TLS SNI routing, based on subdomain pattern

Nginx can be configured to route to a backend, based on the server's domain name, which is included in the SSL/TLS handshake (Server Name Indication, SNI).
This works for http upstream servers, but also for other protocols, that can be secured with TLS.


  • at least nginx 1.15.9 to use variables in ssl_certificate and ssl_certificate_key.
  • check nginx -V for the following:
    TLS SNI support enabled
kekru / 1-Enable Docker Remote API with TLS client
Last active Oct 19, 2020
Docker Remote API with client verification via daemon.json
View 1-Enable Docker Remote API with TLS client

Enable Docker Remote API with TLS client verification

Docker's Remote API can be secured via TLS and client certificate verification.
First of all you need a few certificates and keys:

  • CA certificate
  • Server certificate
  • Server key
  • Client certificate
  • Client key

Create certificate files

kekru / register Hibernate EventListener in
Created Sep 22, 2016
Register a Hibernate Envers EventListener in Spring Boot (Hibernate 4, Hibernate 5)
View register Hibernate EventListener in

Hibernate 4 introduced a new Audit API for event listening.
org.hibernate.envers.event.AuditEventListener was replaced by org.hibernate.event.spi.*, for example org.hibernate.event.spi.PostDeleteEventListener.

First create your custom listener. Example: You want do disable auditing for delete operations.

import org.hibernate.envers.event.spi.EnversPostDeleteEventListenerImpl;
import org.hibernate.event.spi.PostDeleteEvent;

public class MyAuditListener extends EnversPostDeleteEventListenerImpl {
kekru /
Last active Sep 27, 2020
Traefik redirect / (root) to sub path with Docker labels

Traefik: redirect base or root path to a subpath

This is tested with Traefik 1.7

This is how to redirect the root or base path to a sub path in Traefik using Docker labels:

  • ->
  • ->
  • -> no redirect
kekru /
Last active Sep 27, 2020
Dockerfile: Stabilize build cache for COPY command, between different machines

Dockerfile: Remote build cache optimization for COPY (on Windows)

With Docker (especially with Buildkit) you have the ability to share your images as build cache for other computers.

When running the following docker build command, Buildkit will download cache information from the images, referenced with --cache-from.

export IMAGE=""
export IMAGE_LATEST=""
kekru /
Last active Sep 19, 2020
Gradle execute command with environment variables and in other working dir

Gradle: Execute command within dir and with env vars

This is how to create a run function in Gradle (Groovy) to execute a command in a selectable working directory and with additional environment variables.

It is based on groovy's String.execute(...)


kekru /
Last active Sep 12, 2020
Openshift 3.11 in WSL2

Running Openshift 3.11 inside WSL2

This is not running yet, but nearly almost

Install WSL2 and oc client

First install a WSL2 with Ubuntu 20.04 as described at Microsoft

Enter wsl shell

You can’t perform that action at this time.