Skip to content

Instantly share code, notes, and snippets.

View mmacphail's full-sized avatar

Alexandre Fruchaud mmacphail

View GitHub Profile
package eu.mmacphail.threads;
import org.junit.jupiter.api.Test;
import java.time.LocalDateTime;
import java.util.concurrent.*;
import java.util.concurrent.atomic.AtomicInteger;
public class ThreadingTest {
@mmacphail
mmacphail / format_schema_rest.sh
Last active August 21, 2021 20:07
Format avro schema to post using rest API
#!/bin/bash
set -o errexit
set -o xtrace
set -o nounset
FILE=$1
function cleanup {
rm temp.txt
}
@mmacphail
mmacphail / Consumer.java
Created June 22, 2021 12:14
Ideal java consumer
package clients;
import io.confluent.monitoring.clients.interceptor.MonitoringConsumerInterceptor;
import java.time.Duration;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Properties;
import org.apache.kafka.clients.consumer.ConsumerConfig;
import org.apache.kafka.clients.consumer.ConsumerRebalanceListener;
@mmacphail
mmacphail / Producer.java
Last active November 29, 2023 17:31
Ideal java producer
package clients;
import io.confluent.monitoring.clients.interceptor.MonitoringProducerInterceptor;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.List;
import java.util.Properties;
package eu.macphail
sealed class PartOfTree
data class Leaf(val sprite: String = "Leaf") : PartOfTree()
data class Flower(val sprite: String = "Flower") : PartOfTree()
data class Branch(val subParts: List<PartOfTree>,
val enterBranch: String = "Enter Branch",
val exitBranch: String = "Exit Branch") : PartOfTree()
data class Painting(val sprites: String = "") {
@mmacphail
mmacphail / .vimrc
Created August 25, 2020 21:37
WSL2 .vimrc
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
Macro planning
Article 1 : présentation générale de clojure, syntaxe, définitions, fonctions simples
Article 2 : symboles, keywords, values, datastructure, fonctions et macros built-in (if let do map filter), lamda, la doc et son accessibilité, pas de boucles ;), les valeurs truthy
Article 3 : présentation de programmation fonctionnelle dans clojure: la recursion, les lambdas (reduce, loop)
Article 4 : polymorphisme, exemples avancées (trees)
Article 5 : java interop
Article 6 : threading, futures, ref, agents, atoms, STM
Article 7 : macros
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" alternatively, pass a path where Vundle should install plugins
"call vundle#begin('~/some/path/here')
" let Vundle manage Vundle, required
@mmacphail
mmacphail / Guesser.kt
Last active August 19, 2019 20:30
FP to the max implemented with Arrow
package eu.macphail.guesser
import arrow.Kind
import arrow.core.*
import arrow.effects.*
import arrow.extension
import eu.macphail.guesser.io.console.console
import eu.macphail.guesser.io.program.program
import eu.macphail.guesser.io.randomNumberGen.randomNumberGen
import kotlin.random.Random