Skip to content

Instantly share code, notes, and snippets.

@gregorriegler
gregorriegler / SuggestFlywayMigration.java
Last active June 15, 2023 06:55
Generates Flyway Migration Scripts Automatically using Hibernate Schema Updater and Testcontainers
package org.acme;
import com.microsoft.sqlserver.jdbc.SQLServerDriver;
import org.flywaydb.core.Flyway;
import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
import org.hibernate.tool.schema.TargetType;
import org.reflections.Reflections;
import org.springframework.jdbc.datasource.SimpleDriverDataSource;
@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 / 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
@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 / 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 / tdd-bootstrap-ts-mocha-chai.sh
Last active February 5, 2022 12:30
TDD bootstrap for typescript with mocha+chai. use 'curl <raw> | bash -is <folder>'
#!/usr/bin/env bash
# start tdd in one command 'curl <link-to-raw> | bash -s <folder>
if [ $# -ge 1 ]
then
# jump to folder
target="$1"
mkdir -p "$target"
cd "$target"
@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 / tdd-bootstrap-js-mocha-chai.sh
Last active February 19, 2021 18:44
TDD bootstrap for js with mocha+chai. use 'curl <raw> | bash -s <folder>'
#!/usr/bin/env bash
if [ $# -ge 1 ]
then
# jump to folder
target="$1"
mkdir -p "$target"
cd "$target"
fi
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()