Skip to content

Instantly share code, notes, and snippets.

View kekru's full-sized avatar

Kevin Krummenauer kekru

View GitHub Profile
@kekru
kekru / Linux VPN FH-Dortmund.md
Created October 17, 2016 17:26
Connect to FH Dortmund VPN on Ubuntu

Verbindung mit dem VPN der FH Dortmund aufbauen unter Ubuntu

sudo apt-get install -y openconnect iptables expect
sudo openconnect vpngate.fh-dortmund.de
@kekru
kekru / Docker connect to remote server.md
Last active April 15, 2024 16:26
Connect to another host with your docker client, without modifying your local Docker installation

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
kekru / 01nginx-tls-sni.md
Last active April 1, 2024 02:29
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.

prerequisites

  • 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
kekru / 01-Openshift3-WSL2.md
Last active March 30, 2024 06:51
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

@kekru
kekru / traefik-redirect-path.md
Last active March 12, 2024 15:15
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:
Goals

  • https://example.com -> https://example.com/abc/xyz/
  • https://example.com/ -> https://example.com/abc/xyz/
  • https://example.com/something -> no redirect
@kekru
kekru / 01-dockerfile-stabilize-copy-cache.md
Last active February 28, 2024 05:44
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="my-registry.example.com/myproject/myapp:feature-1234"
export IMAGE_LATEST="my-registry.example.com/myproject/myapp:latest"
export DOCKER_BUILDKIT=1
@kekru
kekru / git-copy-files-to-empty-branch.md
Last active February 26, 2024 05:51
git: Copy files to new branch without history, using a squash merge

Git: New branch with files but no history

This is how to copy your files from a given git branch to a new empty branch, using a squash merge.
This example will copy files from branch old-branch to target-branch

# First be sure, that you don't have uncommitted working changes. They will be deleted

# Checkout a new empty branch without history
git checkout --orphan target-branch
@kekru
kekru / register Hibernate EventListener in Spring.md
Created September 22, 2016 16:09
Register a Hibernate Envers EventListener in Spring Boot (Hibernate 4, Hibernate 5)

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
kekru / 01-dark-mode-website.md
Last active January 21, 2024 07:01
Dark-Mode for simple HTML website

Dark mode for simple HTML website

You can add a very basic dark mode for your website using this CSS snippet:

<!DOCTYPE html>
<html>
<head>
  <style>
 @media (prefers-color-scheme: dark) {
@kekru
kekru / 1-Enable Docker Remote API with TLS client verification.md
Last active January 11, 2024 18:21
Docker Remote API with client verification via daemon.json

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