Skip to content

Instantly share code, notes, and snippets.

View luvarqpp's full-sized avatar

luvarqpp

  • QPP a.s.
View GitHub Profile
@luvarqpp
luvarqpp / ReactiveController.java
Created October 13, 2022 13:08
sample ReactiveController in spring, for stackoverflow question
@Controller
@Slf4j
public class ReactiveController {
record SomeDTO(String name, String address) {
}
private final Sinks.Many<SomeDTO> eventSink = Sinks.many().replay().latest();
@RequestMapping(path = "/sse", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
public Flux<ServerSentEvent<SomeDTO>> sse() {
@luvarqpp
luvarqpp / SinkTests.java
Created October 13, 2022 13:06
Sample code for stackoverflow question
import lombok.RequiredArgsConstructor;
import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Sinks;
import reactor.core.scheduler.Schedulers;
import java.util.function.Function;
public class SinkTests {
@luvarqpp
luvarqpp / SlowLorisTester.java
Created March 25, 2022 08:10
Java class which simulates slow loris DoS attack on http server.
import lombok.extern.slf4j.Slf4j;
import java.io.IOException;
import java.io.PrintWriter;
import java.net.InetAddress;
import java.net.Socket;
/**
* Class to empirically test if our server (or whole path including reverse proxy) is thread based or event based.
* Mostly copy/paste from https://stackoverflow.com/a/17558146/11152683
@luvarqpp
luvarqpp / nm_l2tp_ipsec_vpn.md
Last active August 2, 2021 15:31 — forked from pastleo/nm_l2tp_ipsec_vpn.md
setup L2TP IPSEC VPN in archlinux using NetworkManager

setup L2TP IPsec VPN in archlinux using NetworkManager

install networkmanager-l2tp first:

yaourt -S networkmanager-l2tp
apt install -y network-manager-l2tp