Skip to content

Instantly share code, notes, and snippets.

@gregorriegler
gregorriegler / downgrade.md
Created September 6, 2022 17:27
Downgrade arch with paru

Uninstall package

paru -R package

Uninstall package without its dependencies

paru -Rns package
@gregorriegler
gregorriegler / justfile for tdd and tcr
Last active August 9, 2022 12:26
justfile for continuous testing and tcr
goal +MESSAGE:
git pull --rebase --autostash
git commit --allow-empty -m "Goal: {{MESSAGE}}"
git push
done +MESSAGE:
git pull --rebase --autostash
git commit --allow-empty -m "{{MESSAGE}}"
git push
@gregorriegler
gregorriegler / json-to-csv.sh
Last active March 9, 2022 18:54
Sonar Json to Csv
jq -r '["Severity", "Type", "Rule", "File", "Line", "Description"], (.issues[] | [.severity, .type, .rule, .component, ((.textRange.startLine // ""|tostring) + "-" + (.textRange.endLine // ""|tostring)), .message]) | @csv' search.json
@gregorriegler
gregorriegler / windows: kill process blocking port
Last active July 18, 2022 20:30
Windows kill process that blocks port
# find pid that blocks the port
netstat -ano | findstr :<PORT>
# find name of that process
tasklist | findstr '<PID>
# kill the process
taskkill /PID <PID> /F
import java.io.File
import java.time.Duration
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
val formatter: DateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")
fun main() {
File("log.txt")
.readLines()
@gregorriegler
gregorriegler / squash-wip-commits
Last active March 4, 2021 19:10
mob.sh-squash-wip-commits
# GIT_EDITOR replaces the text editor that git would show to let you edit the commit message of the squash
# GIT_SEQUENCE_EDITOR replaces the text editor that lists the commits for a interactive rebase
# Assuming that you use the default mob.sh wip commit message "mob next [ci-skip]",
# this script runs an interactive rebase and squashes commits followed by a "wip commit",
# and then edits the commit messages to keep only those of non-wip commits.
# So you will end up with all manual commits having the changes of wip commits squashed into them.
# If you have only wip commits it might fail the rebase, so make sure there is a manual commit in the end.
#
# E.g.:
# manual-commit-2
@gregorriegler
gregorriegler / dom_inspector.css
Created December 27, 2020 14:27
hacky css inspector for html uis
* {
border: 1px solid red;
}
*:before {
content: "id: " attr(id) " class: " attr(class);
}
@gregorriegler
gregorriegler / maven-module-graph.md
Created December 11, 2020 22:36
maven module graph

mvn com.github.ferstl:depgraph-maven-plugin:aggregate -Dincludes=com.groupId -DcreateImage=true

dot -Tpng dependency-graph.dot > dependency-graph.png

@gregorriegler
gregorriegler / ducky.md
Created August 11, 2020 20:46 — forked from schmich/ducky.md
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

@gregorriegler
gregorriegler / git pretty stat
Created August 10, 2020 16:54 — forked from sephiroth74/git pretty stat
Show lines added/deleted and total commits per author in a period of time on all branches
git log --all --numstat --pretty="%H" --author="author" --since=1.year | awk 'NF==3 {plus+=$1; minus+=$2} NF==1 {total++} END {printf("lines added: +%d\nlines deleted: -%d\ntotal commits: %d\n", plus, minus, total)}'