Skip to content

Instantly share code, notes, and snippets.

@neillfontes
neillfontes / redact-logback.md
Created January 18, 2021 13:58
Logback redact log entries

Use this pattern to match and replace a single bit of information from the logs:

<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %replace(%msg){'(?&lt;=That-Important-Token:).*', '[REDACTED]'}%n</pattern>

The following can be used to augment for multiple matching instead of adding multiple nested replace() statements that would look off

(?&gt;That-Token|Whatever|GDPR).\K.*

@neillfontes
neillfontes / add-mvn-wrapper.sh
Created November 26, 2020 15:25
add mvn wrapper to existing project
mvn -N io.takari:maven:wrapper -Dmaven=3.6.3
@neillfontes
neillfontes / md5-check.sh
Created October 28, 2020 12:50
Compare md5 of a file in artifactory with a local file
#!/bin/bash
#requires md5sum on Mac
#brew install md5sha1sum
VAR1=`curl -s -u '[USER]:[PASSWORD]' https://[artifactory-url]/artifactory/api/storage/[artifact]/[file-name] | jq -r ".checksums.md5"`
VAR2=`md5sum [file-path] | cut -d' ' -f1`
if [ "$VAR1" = "$VAR2" ]; then
echo "They are the same file."