Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View fteychene's full-sized avatar

Francois Teychene fteychene

View GitHub Profile
@fteychene
fteychene / docker-compose-elastic.yml
Created August 10, 2021 08:21
Local Elastic/Kibana stack script
services:
elasticsearch:
image: elasticsearch:7.14.0
hostname: elasticsearch
ports:
- 9200:9200
- 9300:9300
environment:
discovery.type: single-node
networks:
@fteychene
fteychene / main.rs
Created March 5, 2021 15:13
Warp route test
use warp::{Filter, Rejection};
use warp::generic::Either;
fn other_routes() -> impl Filter<Error = Rejection, Extract = (Either<(Either<(String,), (String,)>,), (String,)>,)> + Clone + Send + Sync + 'static {
// GET /hi
let hi = warp::get().and(warp::path("hi").map(|| "Hello, World!".to_string()));
// GET /hello/from/warp
let hello_from_warp = warp::get().and(warp::path!("hello" / "from" / "warp").map(|| "Hello from warp!".to_string()));
// GET /sum/:u32/:u32
let sum = warp::get().and(warp::path!("sum" / u32 / u32).map(|a, b| format!("{} + {} = {}", a, b, a + b)));
[package]
name = "lolilol"
version = "0.1.0"
authors = ["fteychene <francois.teychene@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
lol-core = "0.7.1"
@fteychene
fteychene / build.gradle
Last active October 14, 2020 09:00
Arrow fx coroutine play on Chuck Norris facts
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.4.10'
}
apply plugin: 'kotlin-kapt'
group 'org.example'
version '1.0-SNAPSHOT'
repositories {
@fteychene
fteychene / gameoflife.kt
Created April 30, 2020 07:51
GameOfLife TypeDD and Sequence test
package mtpcraft.tdd.kata
import kotlin.random.Random
sealed class Cell {
companion object
}
object Dead : Cell()
object Living : Cell()
@fteychene
fteychene / build.gradle.kts
Created April 28, 2020 13:57
Basic Zipper in Kotlin with Arrow
plugins {
kotlin("jvm") version "1.3.72"
kotlin("kapt") version "1.3.41"
}
group = "xyz.fteychene.kotlin.sample"
version = "0.1.0-SNAPSHOT"
@fteychene
fteychene / Cargo.toml
Last active April 20, 2020 17:34
Test multi runtime and spwn_blocking in Tokio
[package]
name = "test_multi_runtime"
version = "0.1.0"
authors = ["fteychene <francois.teychene@gmail.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
anyhow = "1.0.28"
@fteychene
fteychene / build.gradle
Created June 17, 2019 12:41
Helios sealed classes encoder/decoder test
plugins {
id 'org.jetbrains.kotlin.jvm' version '1.3.31'
}
apply plugin: 'kotlin-kapt' //optional
group 'io.saagie.playground'
version '1.0-SNAPSHOT'
repositories {
@fteychene
fteychene / StreamInputStream.kt
Last active May 16, 2019 10:04
InputStream to combine a Stream of other InputStream in a lazy way in Kotlin
class StreamInputStream(private val source: Stream<out InputStream>) : InputStream() {
private val iterator by lazy {
source
.flatMap {
generateSequence {
val result = it.read(); if (result == -1) {
it.close(); null
} else result
}.asStream()