Skip to content

Instantly share code, notes, and snippets.

View NotificationController.java
package fr.ght1pc9kc.baywatch.notify.infra;
import fr.ght1pc9kc.baywatch.notify.api.BasicEvent;
import fr.ght1pc9kc.baywatch.notify.api.EventType;
import fr.ght1pc9kc.baywatch.notify.api.NotifyManager;
import fr.ght1pc9kc.baywatch.notify.api.NotifyService;
import fr.ght1pc9kc.baywatch.notify.api.ReactiveEvent;
import fr.ght1pc9kc.baywatch.notify.api.ServerEventVisitor;
import fr.ght1pc9kc.baywatch.techwatch.api.StatService;
import fr.ght1pc9kc.baywatch.techwatch.infra.model.Statistics;
View NotifyServiceImpl.java
package fr.ght1pc9kc.baywatch.notify.domain;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import com.github.f4b6a3.ulid.UlidCreator;
import fr.ght1pc9kc.baywatch.notify.api.BasicEvent;
import fr.ght1pc9kc.baywatch.notify.api.EventType;
import fr.ght1pc9kc.baywatch.notify.api.NotifyManager;
import fr.ght1pc9kc.baywatch.notify.api.NotifyService;
import fr.ght1pc9kc.baywatch.notify.api.ReactiveEvent;
View SplitReactorFluxTest.java
package fr.ght1pc9kc.baywatch;
import lombok.AllArgsConstructor;
import lombok.Value;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Sinks;
import reactor.test.StepVerifier;
import java.util.List;
View backup-dir-hubic.sh
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
#/ Usage: ./backup-dir.sh "gpg-passphrase" "backup-directory"
#/ Description: Compress, crypt and upload each directory to HubiC
#/ Examples: ./backup-dir.sh "xxxxx" "~/photos"
#/ Options:
#/ --help: Display this help message
usage() { grep '^#/' "$0" | cut -c4- ; exit 0 ; }
@Marthym
Marthym / git-repos-update-all.sh
Last active Dec 7, 2017
Update multiple git repositories
View git-repos-update-all.sh
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
#/ Usage: git-repos-update-all.sh
#/ Version: 2.0
#/ Description: Find all git repository from `~/` and update them in multi-thread mode.
#/ Options:
#/ --help: Display this help message
function usage() { grep '^#/' "$0" | cut -c4- ; exit 0 ; }
View store-id.pl
#!/usr/bin/perl
use strict;
use warnings;
$|=1;
my %url;
# read config file
open CONF, $ARGV[0] or die "Error opening $ARGV[0]: $!";
while (<CONF>) {
@Marthym
Marthym / gist:1db21f44b7f296fcaf1f
Created Apr 1, 2015
Start Neo4j Impermanent Database + REST Server on random port for test
View gist:1db21f44b7f296fcaf1f
db = new TestGraphDatabaseFactory().newImpermanentDatabase();
boolean available = db.isAvailable(5000);
assert available;
int start = -1;
Random random = new Random();
while (start != 0) {
port = RANDOM_PORTS_LOWER_BOUND + random.nextInt(RANDOM_PORTS_COUNT);
try {
@Marthym
Marthym / gist:688e060560e6ae7454cf
Created Nov 5, 2014
Wait until database is correctly started
View gist:688e060560e6ae7454cf
/* Using a mysql inside docker for executing test, I need to wait for MySQL is completly started before running test */
Awaitility.await().atMost(5, TimeUnit.SECONDS).pollInterval(1, TimeUnit.SECONDS).until(new Callable<Boolean>() {
@Override
public Boolean call() throws Exception {
try (Connection conn = ds.getConnection()) {
return true;
} catch (Exception e) {
System.out.println(e.getClass() + ": " + e.getLocalizedMessage());
return false;
}