Skip to content

Instantly share code, notes, and snippets.

@kekru
kekru / 01-diff-targz-in.vscode.md
Last active December 16, 2024 12:55
Diff .tar.gz files in vscode

Diff .tar.gz files in vscode (and other git clients)

Tested on Windows, but should also work on Linux and Max

  1. Store the targzDiff.sh from below somewhere on your computer
  2. Add to your ~/.gitconfig with path to local stored targzDiff.sh
[diff "targz"]
 textconv = sh -c 'cat $0 | ~/some/where/targzDiff.sh'
@kekru
kekru / Confluence-Server-find-broken-attachments.md
Last active May 19, 2023 13:17
Confluence Server find broken attachments

Confluence Server find broken attachments

Tested on Confluence Server 7.19.7 with MySQL DB

Based on How to determine the file paths for a page's attachments.
This is how to find out which attachments can not be downloaded, because the file is not found on the file system.

Create /tmp/query.sql

@kekru
kekru / 01-pgadmin-6.15-not-working-with-nginx.md
Last active November 9, 2022 13:10
pgAdmin 6.15 does not work with nginx reverse proxy
@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-sonar-aggregate-generic-testdata.md
Last active August 9, 2023 13:47
Aggregate Sonar Generic Test Data Execution

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 October 1, 2024 15:42
nginx: Serve a file from Artifactory without login

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 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-VSCode-foreach-project.md
Last active March 13, 2022 15:21
Command for each project in VS Code workspace

Run a command in every directory of a VSCode workspace

Deno must be installed.
On Windows GitBash is required.

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/25072c432cbadee38ca2d725fbe7f03f5f6eafcc/vsforeach.js"
@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-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) {