Skip to content

Instantly share code, notes, and snippets.

@jakzal
jakzal / 01 - LearnPostgresListenNotifyTest.cs
Last active December 12, 2024 11:55
Learn how to use LISTEN/NOTIFY in PostgreSQL
using KaffeineLabs.MQ.Outbox;
using KaffeineLabs.Testcontainers.PostgreSql;
using FluentAssertions;
using Microsoft.EntityFrameworkCore;
using Npgsql;
using Xunit.Abstractions;
namespace KaffeineLabs.MQ.Tests.Outbox;
public class LearnPostgresListenNotifyTest(PostgreSqlFixture postgreSql, ITestOutputHelper testOutputHelper)
@jakzal
jakzal / 01 - exposed - ExposedPaymentRepository.kt
Created August 24, 2024 11:24
Using Testcontainers with Kotlin Exposed
package payment.exposed
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.transactions.transaction
import org.junit.jupiter.api.BeforeEach
import org.testcontainers.containers.PostgreSQLContainer
import org.testcontainers.junit.jupiter.Container
import org.testcontainers.junit.jupiter.Testcontainers
import org.testcontainers.utility.DockerImageName
import payment.Payment
@jakzal
jakzal / 1 Readme.md
Last active December 13, 2023 21:18
Nextcloud behind Cloudflare on a Raspberry PI
@jakzal
jakzal / 00 - Object-oriented event sourcing.adoc
Last active November 30, 2023 14:17
Object-oriented event sourcing
@jakzal
jakzal / 00 - Deriving state from events.adoc
Last active November 30, 2023 14:17
Deriving state from events
@jakzal
jakzal / Singleton.java
Created March 23, 2023 10:32
Singleton Supplier
package com.kaffeinelabs.function;
import java.util.function.Supplier;
public class Singleton<T> implements Supplier<T> {
private final Supplier<? extends T> factory;
private T instance = null;
private Singleton(final Supplier<? extends T> factory) {
this.factory = factory;
@jakzal
jakzal / DebeziumContainers.java
Created January 9, 2023 13:19
Learn how to run Debezium with PostgreSQL and Kafka with Junit 5
package com.kaffeinelabs.debezium;
import io.debezium.testing.testcontainers.DebeziumContainer;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.containers.Network;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.lifecycle.Startable;
import org.testcontainers.utility.DockerImageName;
@jakzal
jakzal / README.md
Created January 12, 2022 14:42
OpenSearch terraform configuration for local development
@jakzal
jakzal / Dockerfile
Last active January 2, 2022 22:10
MiTemperature2 / Home Assistant / MQTT
ARG PYTHON_VERSION=3.10
ARG BASE_IMAGE=python:${PYTHON_VERSION}-slim
ARG MITEMP_TARGET_DIR=/mitemp2
FROM ${BASE_IMAGE} AS builder
ARG MITEMP_TARGET_DIR
ENV PATH=$MITEMP_TARGET_DIR/bin:$PATH
RUN apt-get update && apt-get install -y --no-install-recommends build-essential gcc git libglib2.0-dev && rm -rf /var/lib/apt/lists/*