Skip to content

Instantly share code, notes, and snippets.

View razvn's full-sized avatar

Razvan razvn

  • Montpellier, France
  • X @razvn
View GitHub Profile
@razvn
razvn / Kondor-EnumSerialisationExemple.kt
Created October 15, 2021 16:59
Kondor-Enum_label_serialisation
package net.razvan.kondortest
import net.razvan.kondortest.TitleType.Companion.fromLabel
import com.ubertob.kondor.json.JAny
import com.ubertob.kondor.json.JStringRepresentable
import com.ubertob.kondor.json.jsonnode.JsonNodeObject
import com.ubertob.kondor.json.obj
import com.ubertob.kondor.json.str
import com.ubertob.kondor.json.toPrettyJson
import com.ubertob.kondor.outcome.recover
@razvn
razvn / index.html
Created April 27, 2021 09:56
Http4k WebSocket remote shell
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Remote terminal</title>
<style>
textarea {
background-color: #000;
border: 1px solid #000;
color: #00ff00;
@razvn
razvn / http4k.kt
Last active April 16, 2021 17:00
http4k endpoint that makes the call to another url and return the response
// all calls on `$path` are redirected to `$url`
// ex: server `http://localport:8080` call `MocksRoute("http://google.com", "proxy")`
// all calls to `http://localport:8080/proxy/<whatever>` will respond with the response of `http://google.com/<whatever>`
// query params and headers are forwarded
object MocksRoute {
private val pathLens = Path.string().of("reqpath")
operator fun invoke(url: String, path: String = "", client: HttpHandler = OkHttp()): RoutingHttpHandler =
routes("/$path/{reqpath:.*}" bind handler(url, client))
@razvn
razvn / TestMySqlContainer.kt
Created September 2, 2019 22:00
TestContainers SpringBoot Kotlin
package net.razvan.webfluxjpatestcontiainers
import org.testcontainers.containers.MySQLContainer
object TestMySqlContainer : MySQLContainer<TestMySqlContainer>("mysql:5.7") {
override fun start() {
super.start()
System.setProperty("DB_URL", this.jdbcUrl)
System.setProperty("DB_USERNAME", this.username)