Skip to content

Instantly share code, notes, and snippets.

View ygrenzinger's full-sized avatar

Yannick Grenzinger ygrenzinger

View GitHub Profile
@ygrenzinger
ygrenzinger / Cell.kt
Created March 18, 2019 15:24
Kotlin Game of Life with JC Melikian
enum class Cell {
ALIVE {
override fun nextGeneration(neighbors: Int): Cell {
if (neighbors == 2 || neighbors == 3) return this
return DEAD
}
}, DEAD {
override fun nextGeneration(neighbors: Int): Cell {
if (neighbors == 3) return ALIVE
return this
@ygrenzinger
ygrenzinger / Day6.kt
Last active December 26, 2018 21:36
Advent of Code
import java.io.File
import java.util.*
import java.util.concurrent.atomic.AtomicInteger
data class Coordinate(val x: Int, val y: Int)
data class Point(val label: Int, val coordinate: Coordinate)
data class area(val associatedToPoint: Point, val size: Int = 0)
var seqId = AtomicInteger(1)
@ygrenzinger
ygrenzinger / Latencies.md
Last active February 16, 2020 20:48
Latencies

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

@ygrenzinger
ygrenzinger / Pitch.md
Last active August 2, 2018 19:46
CfP - La crise du logiciel n’est pas technique.

Si vous pensez qu’on ne sait toujours pas faire du logiciel, rassurez-vous ce n’est pas à cause de Javascript! Cette crise date même des années 70. Cependant notre communauté continuent de chercher des solutions techniques à cette crise. A un moment, ce fut UML et MDE, puis agilité et craft maintenant ce serait la programmation fonctionnelle et les types.

Malheureusement toutes ces solutions essayent de résoudre un problème qui serait local et compliqué alors que la création de la valeur par le logiciel est un problème complexe qui dépasse largement le cadre de l’équipe de développement. Dans cette présentation, j’aimerais partager avec vous ce constat, prendre de la hauteur et voir en quoi il va falloir comprendre que, oui le professionnalisme du dev est indispensable, mais la solution est en fait au niveau de l’organisation.

En clair, pour résoudre la crise du logiciel, il va falloir revoir les règles des systèmes qui produisent du logiciel.

@ygrenzinger
ygrenzinger / MonadExs.hs
Last active December 14, 2022 07:39
Functor -> Applicative -> Monad typeclasses
-- Two datatypes
data Optional a = Some a | Empty deriving (Eq, Show)
data Or a b = A a | B b deriving (Eq, Show)
-- functor instances
instance Functor Optional where
fmap f (Some a) = Some (f a)
fmap _ Empty = Empty
instance Functor (Or a) where
%http://rigaux.org/language-study/syntax-across-languages-per-language/Oz.html
% https://mozart.github.io/mozart-v1/doc-1.4.0/tutorial/index.html
% Function which produce number with closure and
declare ProduceNumbersUntil
fun {ProduceNumbersUntil N}
local Produce in
fun {Produce L}
{Delay 500}
if L == N then N|nil else L|{Produce L+1} end
@ygrenzinger
ygrenzinger / demo.oz
Last active April 18, 2018 19:32
NCraft code
%http://rigaux.org/language-study/syntax-across-languages-per-language/Oz.html
% https://mozart.github.io/mozart-v1/doc-1.4.0/tutorial/index.html
% Function which produce number with closure and
declare ProduceNumbersUntil
fun {ProduceNumbersUntil N}
local Produce in
fun {Produce L}
{Delay 500}
if L == N then N|nil else L|{Produce L+1} end
@ygrenzinger
ygrenzinger / TraceRestTemplateInterceptor.java
Created March 7, 2018 06:44
Proposal for skipPattern on ZipKin Rest Template interceptor
/*
* Copyright 2013-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@ygrenzinger
ygrenzinger / CleanArchitecture.md
Last active March 31, 2024 13:57
Summary of Clean Architecture by Robert C. Martin

Summary of book "Clean Architecture" by Robert C. Martin

Uncle Bob, the well known author of Clean Code, is coming back to us with a new book called Clean Architecture which wants to take a larger view on how to create software.

Even if Clean Code is one of the major book around OOP and code design (mainly by presenting the SOLID principles), I was not totally impressed by the book.

Clean Architecture leaves me with the same feeling, even if it's pushing the development world to do better, has some good stories and present robust principles to build software.

The book is build around 34 chapters organised in chapters.