Skip to content

Instantly share code, notes, and snippets.

Avatar

Kevin Krummenauer kekru

View GitHub Profile
@kekru
kekru / 01-sonar-aggregate-generic-testdata.md
Last active Apr 27, 2021
Aggregate Sonar Generic Test Data Execution
View 01-sonar-aggregate-generic-testdata.md

Sonarqube aggregate Generic Test Data Execution

This is how to combine multiple SonarQube test data reports in the Generic Execution format, using node js.

This can be useful, if you run multiple jest tests, exporting with jest-sonar-reporter and want to combine the results to pass it to SonarQube

We will use glob to find files and xml2js to combine them.

@kekru
kekru / 01-nginx-serve-artifactory-unauthenticated.md
Last active Feb 23, 2021
nginx: Serve a file from Artifactory without login
View 01-nginx-serve-artifactory-unauthenticated.md

nginx: serve a file from Artifactory without authentication

With the following nginx config you can expose a single file from Artifactory without need to authenticate.
Be sure that you only expose the files that are allowed to be public

I dont't recommend to run this nginx in the public internet. Run it only inside your company's firewall!
No warranty, that is totally safe.

nginx config

@kekru
kekru / 01-gradle-union-task-order.md
Created Feb 16, 2021
Gradle union task, execute in order
View 01-gradle-union-task-order.md

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-VSCode-foreach-project.md
Last active Apr 14, 2021
Command for each project in VS Code workspace
View 01-VSCode-foreach-project.md

Run a command in every directory of a VSCode workspace

Currently only for Windows using GitBash.
Deno must be installed.

Setup an alias and then run a command in every project of a VSCode workspace

# Store alias in $HOME/.bashrc
alias vsforeach="deno run --allow-run --allow-read https://gist.githubusercontent.com/kekru/256d73c7819efc35e55cd88c5903ab46/raw/d14aa519cd4709c66d4a57ec5487a11c800589ad/vsforeach.js"
@kekru
kekru / 01-serve-static-site-deno.md
Last active Jan 27, 2021
Serve static site using deno
View 01-serve-static-site-deno.md

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-dark-mode-website.md
Last active Nov 20, 2020
Dark-Mode for simple HTML website
View 01-dark-mode-website.md

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 / 01-disable-windows-error-sound.md
Last active Oct 22, 2020
Disable Windows Default Error Sound
View 01-disable-windows-error-sound.md

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 Sep 27, 2020
Dockerfile: Stabilize build cache for COPY command, between different machines
View 01-dockerfile-stabilize-copy-cache.md

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 Sep 19, 2020
Gradle execute command with environment variables and in other working dir
View 01-gradle-execute-command.md

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 Apr 22, 2021
Openshift 3.11 in WSL2
View 01-Openshift3-WSL2.md

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