Skip to content

Instantly share code, notes, and snippets.

@gregorriegler
gregorriegler / intellij-live-templates.java
Created August 4, 2019 19:12
intellij live templates
// log live template
private static final org.slf4j.Logger LOG = org.slf4j.LoggerFactory.getLogger($CLASS$.class);
// equals + hashcode live template
@Override
public boolean equals(Object other) {
return org.apache.commons.lang3.builder.EqualsBuilder.reflectionEquals(this, other);
}
@Override
@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
@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 / 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 / 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)}'
@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 / 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 / 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 / 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
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()