Skip to content

Instantly share code, notes, and snippets.

@findepi
findepi / rerun-pr-checks.sh
Last active June 14, 2024 12:50
Tirelessly rerun all the failed checks in all open PRs
#bash
set -euo pipefail
sleep_before_reruns_seconds=$[10 * 60]
while true; do
slept=false
for pr_link in $(gh pr list --search 'author:@me' --limit 999 --json 'url' --jq '.[].url'); do
echo "checking PR ${pr_link}"
@findepi
findepi / Dockerfile
Last active March 14, 2024 10:04
Retrieved GitHub secrets securely
# store as docky/Dockerfile to match references in the other script
FROM ubuntu:latest
RUN true && \
export DEBIAN_FRONTEND=noninteractive && \
apt-get update && \
apt-get install -y openssl && \
apt-get clean && \
echo OK

quick build

./gradlew -x test -x integrationTest build

full build, like mvn install

By default only modules for one Spark/Flink/Scala versions are built. To get the full build, component versions need to be enumerated.

@findepi
findepi / maven-release.md
Last active January 4, 2023 14:06
Standard maven release process
mvn clean release:clean && mvn release:prepare
# `env GPG_TTY=$(tty)` may help with some sort of GPG problems
mvn release:perform
  1. Intellij Preferences > Live Templates > group other
  2. Add a new one with
    • abbreviation rnn
    • Description requireNonNull
    • Template text java.util.Objects.requireNonNull($var$, "$var$ is null")
    • Applicable contexts: Java > Expression
    • check use static imports if possible
  • Edit variables button and there add var variable with variableOfType("Object") expression
@findepi
findepi / client-certificate-authentication.md
Created October 29, 2018 11:50 — forked from jankronquist/client-certificate-authentication.md
Java certificate authentication for both server and client using shared trusted CA.

Certificates

CA and trust keystore

keytool -genkeypair -keyalg RSA -keysize 2048 -validity 365 -alias ca -dname "CN=ca,O=HMS,S=SE" -keystore ca.jks -storepass password
keytool -exportcert -rfc -alias ca -keystore ca.jks -storepass password > ca.pem
cat ca.pem | keytool -importcert -alias ca -noprompt -keystore trust.jks -storepass password

server cert

@findepi
findepi / Directions for creating PEM files
Created September 26, 2018 20:06 — forked from dain/Directions for creating PEM files
Create Java KeyStore from standard PEM encoded private key and certificate chain files
# To regenerate the test key and certificates
# Generate an RSA private key and convert it to PKCS8 wraped in PEM
openssl genrsa 2048 | openssl pkcs8 -topk8 -inform pem -outform pem -nocrypt -out rsa.key
# Generate a certificate signing request with the private key
openssl req -new -key rsa.key -out rsa.csr
# Sign request with private key
openssl x509 -req -days 10000 -in rsa.csr -signkey rsa.key -out rsa.crt
# Here are some JVM args that are extremely useful in production when things go wrong
-XX:+G1SummarizeRSetStats
-XX:G1SummarizeRSetStatsPeriod=10
-XX:+PrintAdaptiveSizePolicy
-XX:+PrintJNIGCStalls
-XX:+PrintReferenceGC
-XX:+PrintGCCause
-XX:+PrintGCDateStamps
-XX:+PrintGCTimeStamps
-XX:+PrintGCDetails

Source: https://gist.github.com/findepi/04c96f0f60dcc95329f569bb0c44a0cd .

quick build

./mvnw -T2C clean install -nsu -DskipTests -Dmaven.javadoc.skip=true -Dmaven.source.skip=true -Dair.check.skip-all=true -pl '!:trino-server-rpm,!:trino-docs,!:trino-proxy,!:trino-verifier,!:trino-benchto-benchmarks'

run Trino in a container, quickly

docker rm -f trino; docker run --rm -it --name trino -p 8080:8080 trinodb/trino:438
@findepi
findepi / librus-plan-lekcji-przygotuj-do-wydruku.js
Last active August 31, 2023 15:49
Przygotuj Librusowy plan lekcji do wydruku na prawdę do wydruku
/*
* Class timetable as rendered in the Librus Synergia system https://synergia.librus.pl/
*/
(function($) {
// przerwy
$('.plan-lekcji tr.line0').remove()
// sobota, niedziela oraz nr lekcji z prawej strony