Skip to content

Instantly share code, notes, and snippets.

View kekru's full-sized avatar

Kevin Krummenauer kekru

View GitHub Profile
@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-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 / 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 / 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-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-serve-static-site-deno.md
Last active January 27, 2021 20:44
Serve static site using deno

Serve static local site using deno and abc

This is how to create a simple static file server with deno and abc.
It serves the current dir and you can run it directly from the hosted script:

  • deno run --allow-net="0.0.0.0:80" --allow-read https://kekru.de/serve.ts
  • or deno run --allow-net="0.0.0.0:80" --allow-read https://gist.githubusercontent.com/kekru/751e32b5d97661f3649ce8ad8f8517ba/raw/2982a65c1205f72c56daf8827a8fc2f6b012600d/serve.ts
@kekru
kekru / 01-gradle-union-task-order.md
Created February 16, 2021 20:19
Gradle union task, execute in order

Gradle: Union wrapper task to execute subtasks in order

This is how to create a union tasks to execute subtasks in order

task A { doLast { println 'A' }}
task B { doLast { println 'B' }}
task C { doLast { println 'C' }}
task D { doLast { println 'D' }}
@kekru
kekru / .01-gradle-gpg.md
Last active May 19, 2021 16:43
Gradle read secrets from gpg encrypted file

Gradle: Read repository secret from gpg encrypted .netrc file

This is how to read credentials from a .netrc formatted file, which is encrypted using gpg and use these credentials as login data for gradle remote repositories.

First you need to have gpg keys created.

Then create a ~/.netrc as shown below and encrypt it with gpg -r <your email> -e ~/.netrc, which will create a .netrc.gpg. Remove the unencypted .netrc afterwards.
Now create a ~/.gradle/init.gradle as shown below.

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