Skip to content

Instantly share code, notes, and snippets.

View mesketh's full-sized avatar
👨‍💻
On vacation

Mark Hesketh mesketh

👨‍💻
On vacation
  • Crestwood, NSW, Australia
View GitHub Profile
@mesketh
mesketh / PaymentTxn.java
Created February 26, 2020 01:03
Judy - this is what i've implemented.
String usernamePrefix =
box.getEnv().getUsername().toUpperCase().replaceAll("[^a-zA-Z0-9]", StringUtil.EMPTY_STRING);
@mesketh
mesketh / AppConfig.java
Created March 28, 2022 23:10
example percentiles - spring boot
package org.eclipse.jkube.maven.sample.spring.boot;
import io.prometheus.client.CollectorRegistry;
import io.prometheus.client.Histogram;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Lazy;
@Configuration
<?xml version="1.0" encoding="UTF-8"?>
<code_scheme name="GoogleStyle">
<option name="OTHER_INDENT_OPTIONS">
<value>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
<option name="USE_TAB_CHARACTER" value="false" />
<option name="SMART_TABS" value="false" />
<option name="LABEL_INDENT_SIZE" value="0" />
@mesketh
mesketh / java
Created July 6, 2022 02:29
KafkaMetaAdder-example-post-processor
/*
* Copyright 2008-present MongoDB, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@mesketh
mesketh / Lipu-example
Created November 12, 2024 07:21
comparing two different collections on common attribute reactively.
@Test
public void testComparingTwoDifferentReactiveCollectionsOnMatchingAttribte() {
final Mono<List<RecordA>> recordAMonoList = Mono.just(
List.of(new RecordA("1"), new RecordA("2")));
final Mono<List<RecordB>> recordBMonoList = Mono.just(
List.of(new RecordB("1", "Record 1"), new RecordB("2", "Record 2")));
recordAMonoList.zipWith(recordBMonoList).map(this::compareAndFilterLists).subscribe(
System.out::println, System.err::println, () -> System.out.println("Done")
public record RecordA(String id) { }
public record RecordB(String id, String name) { }
@Test
public void testComparingTwoDifferentReactiveCollectionsOnMatchingAttribte() {
final Mono<List<RecordA>> recordAMonoList = Mono.just(
List.of(new RecordA("1"), new RecordA("2"), new RecordA("3")));
final Mono<List<RecordB>> recordBMonoList = Mono.just(
List.of(new RecordB("1", "Record 1"), new RecordB("2", "Record 2")));
public record RecordA(String id) { }
public record RecordB(String id, String name) { }
@Test
public void testFilteringRecordAListWithIdsNotFoundOnRecordBList() {
final Mono<List<RecordA>> recordAMonoList = Mono.just(
List.of(new RecordA("1"), new RecordA("2"), new RecordA("3"), new RecordA("4")));
final Mono<List<RecordB>> recordBMonoList = Mono.just(
List.of(new RecordB("1", "Record 1"), new RecordB("2", "Record 2")));
<NotificationDetails xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect"><NotificationId>NH-20260323210044244-66f71b0bec6e4fdba90edfbea2fc87dc-08</NotificationId><Location>sb://mygov-mobile-app-notifications-dev.servicebus.windows.net/test/messages/NH-20260323210044244-66f71b0bec6e4fdba90edfbea2fc87dc-08?api-version=</Location><State>Completed</State><EnqueueTime>2026-03-23T21:00:44.244Z</EnqueueTime><StartTime>2026-03-23T21:00:44.244Z</StartTime><EndTime>2026-03-23T21:00:44.484668Z</EndTime><NotificationBody>{"notificationType":"inbox","title":"myGov","actionParams":"","message":"New Inbox message from Centrelink","actionName":"inbox"}</NotificationBody><Tags>$InstallationId:{2C267846-5B56-4C98-BE6C-3C1A4252A200} &amp;&amp; inbox</Tags><TargetPlatforms>apple</TargetPlatforms><ApnsOutcomeCounts><Outcome><Name>Success</Name><Count>1</Count></Outcome></ApnsOutcomeCounts></NotificationDetails>