Skip to content

Instantly share code, notes, and snippets.

@stephankoelle
stephankoelle / custom.sh
Created June 17, 2025 09:49
podman systemd service (with quadlet) starting a private container with ecr login
# custom.container
#
# This does login into ECR and starts a private container on boot with podman and quadlet / systemd.
# The container is running rootless, the systemd service is a 'user' service
# This is build to work on Fedora CoreOS, even the aws-cli does not need to be installed, it's used from aws public container repo.
# You need to have valid aws credentials in ~/.aws/
# Replace the *** with your correct aws ecr url
#
# This file was partly generated with podlet
#
@stephankoelle
stephankoelle / snippet.html
Created June 17, 2025 09:48
Simple, good looking, css only, burger menu
<style>
/* Burger Menu Styles */
.burger-menu {
position: relative;
z-index: 1001;
}
.burger-icon {
position: fixed;
top: 20px;
@stephankoelle
stephankoelle / snippet.java
Created June 17, 2025 09:48
Integrating AWS Secrets Manager for Secure Secrets Management in Quarkus application.properties
package de.sk;
import io.quarkus.runtime.annotations.StaticInitSafe;
import org.eclipse.microprofile.config.spi.ConfigSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import software.amazon.awssdk.auth.credentials.DefaultCredentialsProvider;
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient;
import software.amazon.awssdk.services.secretsmanager.model.GetSecretValueRequest;
@stephankoelle
stephankoelle / snippet.yaml
Created June 17, 2025 09:47
Terraform for Hetzner Cloud Fedora CoreOS
# Alter:
# hcloud_server_type
# ssh_public_key_file
# ssh_private_key_file
# versions.tf
terraform {
required_providers {
hcloud = {
@stephankoelle
stephankoelle / snippet.markdown
Created June 17, 2025 09:46
minimal caddy file with podlet & quadlet

caddyfile

Define both domains and obtain certificates

www.abc.com, abc.com {
    # Redirect www to the bare domain
    @www {
        host www.abc.com
    }
    redir @www https://abc.com{uri}
@stephankoelle
stephankoelle / manage_fleetlock.service
Created June 17, 2025 09:45
run fleetlock server only when someone can handle emergencies
#~/.config/systemd/user/manage_fleetlock.service
#journalctl --user -t manage_fleetlock
[Unit]
Description=Manage fleetlock service based on public holidays and work hours
[Service]
Type=oneshot
ExecStart=/usr/local/bin/manage_fleetlock.sh
@stephankoelle
stephankoelle / Dockerfile
Created June 17, 2025 09:44
Build docker container with bitbucket pipelines & upload to private ecr repository
# Use Maven 3.9.X with Eclipse Temurin JDK 21 as the base image
#FROM docker.io/library/maven:3.9.9-eclipse-temurin-21
FROM public.ecr.aws/docker/library/maven:3.9.9-eclipse-temurin-21
# Set working directory
WORKDIR /app
# Environment variables (replace with actual values or set dynamically in pipeline)
ARG bitbucketpipelines_bootstrap
ARG bamboo_id_rsa
@stephankoelle
stephankoelle / H2ServerStarter.java
Created June 17, 2025 09:43
Start h2 server in a quarkus app, to connect also from a SQL tool (for example intellij) to the dev database
import io.quarkus.runtime.ShutdownEvent;
import io.quarkus.runtime.StartupEvent;
import jakarta.inject.Inject;
import org.h2.tools.Server;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.enterprise.event.Observes;
import org.jboss.logging.Logger;
import java.sql.SQLException;
@stephankoelle
stephankoelle / intersect.sh
Created June 17, 2025 09:42
Find the sessionId (sessionId intersection) that visited a list of productIds
#!/bin/bash
set -e
file=/opt/epoq/wildfly/standalone/log/access*
for pid in 40683780 406837806 732586891 732586894 732586900 ; do
echo $file
cat $file | grep -a $pid | perl -nle 'print $1 if /sessionId=(.*?)&/;' > /tmp/mop/$pid.data
done
# List of files
@stephankoelle
stephankoelle / extract.markdown
Created June 17, 2025 09:42
Perl One-Liner to Extract Data Using a Regular Expression

Extract top 1000 slowest requests for a access log file

cat /opt/epoq/wildfly/standalone/log/accesslog | grep -a getRec | perl -nle 'print "$1 $_" if m/ D(.*?) /;' | sort -n | tail -n 1000

This command is designed to:

Filter log entries related to getRec requests.
Extract specific numerical or timestamp-like data following the D character.