Skip to content

Instantly share code, notes, and snippets.

View kekru's full-sized avatar

Kevin Krummenauer kekru

View GitHub Profile
@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 / 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-container-structure-test.md
Last active May 30, 2019 18:54
Dockerfile for container-structure-test

Dockerfile for container-structure-test

Use the following docker-compose file. It will build directly from this gist.
To be more stable, copy the Dockerfile and build on your own.

version: "3.3"

services:
 structure-test:
@kekru
kekru / 01-reveal-md-plantuml.md
Last active June 13, 2022 18:43
reveal-md integrate plantuml

Integrate plantuml in reveal-md

This is how to integrate plantuml scripts in you reveal-md presentations.

Download the preproc.js from below to your project and replace the plantuml server url with your plantuml server.
Also replace the plantumlDir with your target dir for the generated png files.
Run reveal-md with the preproc.js:

reveal-md slides.md --preprocessor preproc.js
@kekru
kekru / ssh-commands.md
Created June 3, 2019 16:42
ssh commands

SSH commands

Find out own SSH fingerprint:

ssh-keygen -lf /etc/ssh/ssh_host_ecdsa_key.pub

Add own public key to remote server for later verification:

@kekru
kekru / 01-IntelliJ-Multiple-Gradle-Projects.md
Last active September 22, 2023 14:28
IntelliJ Multiple Gradle Projects

Multiple Gradle projects in IntelliJ

This is how to open multiple gradle projects in a single IntelliJ window.

  • File -> New -> Project ... -> Empty Project
  • File -> Project Structure ... -> Modules -> Plus Sign -> Import Module
    • Choose your Module -> Import module from external model -> Gradle -> Next
    • Activate Checkbox: "Create separate module per source set"
    • Activate Radio: "Use gradle wrapper task configuration"
  • Finish
@kekru
kekru / 01-Convert-to-UTF8-Linux.md
Created July 14, 2019 19:02
Convert all files of a dir to UTF8

Convert files of a dir to UTF8

Run this script on linux.
Modify the "find" call and the source encoding.
The example will match all .java files in the current folder and its subfolders and converts from Cp1252 (Windows) to UTF-8.

#!/bin/bash

# modify this find call for your needs
@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 / process-file-locking-find.md
Last active August 27, 2021 02:08
Windows: Find process locking a file or directory

Find and stop process locking file on Windows

  • Download Handle
    or install with chocolatey:
    choco install -y handle
  • Print all file handles in a file:
    handle > handles.log
  • Find the process in handles.log (e.g example.exe) and stop it with Powershell:
    Stop-Process -Name example
@kekru
kekru / Dockerfile
Created July 28, 2020 10:09
gitlab-ci-pipelines-exporter on alpine
FROM alpine:3.9.6
COPY --from=mvisonneau/gitlab-ci-pipelines-exporter:0.2.14 /usr/local/bin/gitlab-ci-pipelines-exporter /usr/local/bin/
RUN apk add --no-cache ca-certificates
USER 65534
EXPOSE 8080