Skip to content

Instantly share code, notes, and snippets.

@kekru
kekru / 01-disable-windows-error-sound.md
Last active October 22, 2020 14:44
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
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 / 01-gradle-execute-command.md
Last active September 19, 2020 21:19
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(...)

build.gradle

@kekru
kekru / 01-Openshift3-WSL2.md
Last active September 3, 2024 10:49
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 / 01-docker-nginx-static-and-proxy-pass.md
Last active July 1, 2021 18:10
docker nginx static file and proxy pass

nginx docker serve static files

Simple Docker Setup for serving static files and proxy pass a path to a server

Just click "Download ZIP" oder "Embed -> Clone" and then run docker-compose up.
The server is available on http://localhost:8080 and will serve the files in ./static

@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
@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 / 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 / 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 / 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