Skip to content

Instantly share code, notes, and snippets.

View alexandrepiveteau's full-sized avatar

Alexandre Piveteau alexandrepiveteau

View GitHub Profile
@alexandrepiveteau
alexandrepiveteau / Sf_out.cpp
Created June 6, 2023 13:46
Double negation in the Soufflé Datalog interpreter
#include "Sf_out.hpp"
namespace functors {
extern "C" {
}
} //namespace functors
namespace souffle {
using namespace souffle;
Sf_out::Sf_out():
symTable(),
@alexandrepiveteau
alexandrepiveteau / problem_a.c
Created May 19, 2022 14:11
CS-250 Implementation Assignment
#include <stdbool.h>
#include <stdio.h>
#define MAX_DEPTH_X 501
#define MAX_DEPTH_Y 101
#define MAX_DEPTH_Z 101
#define MAX_DEPTH_STACK (MAX_DEPTH_X * MAX_DEPTH_Y * MAX_DEPTH_Z)
// DFS EXPLORATION STACK
@alexandrepiveteau
alexandrepiveteau / ScalabilityTest.kt
Created July 30, 2021 14:51
ScalabilityTest.kt from Markdown Party
package io.github.alexandrepiveteau.echo
import io.github.alexandrepiveteau.echo.core.causality.EventIdentifier
import io.github.alexandrepiveteau.echo.core.causality.SequenceNumber
import io.github.alexandrepiveteau.echo.core.causality.SiteIdentifier
import io.github.alexandrepiveteau.echo.core.causality.nextSiteIdentifier
import io.github.alexandrepiveteau.echo.demo.counter.PNCounterEvent
import io.github.alexandrepiveteau.echo.demo.counter.PNProjection
import io.github.alexandrepiveteau.echo.projections.OneWayProjection
import io.github.alexandrepiveteau.echo.sync.SyncStrategy.Companion.Once
@alexandrepiveteau
alexandrepiveteau / benchmark.kt
Created July 23, 2021 08:56
Echo library benchmark
package io.github.alexandrepiveteau.echo.samples
import io.github.alexandrepiveteau.echo.Exchange
import io.github.alexandrepiveteau.echo.core.causality.EventIdentifier
import io.github.alexandrepiveteau.echo.core.causality.nextSiteIdentifier
import io.github.alexandrepiveteau.echo.mutableSite
import io.github.alexandrepiveteau.echo.projections.ChangeScope
import io.github.alexandrepiveteau.echo.projections.TwoWayProjection
import io.github.alexandrepiveteau.echo.protocol.Message.Incoming as I
import io.github.alexandrepiveteau.echo.protocol.Message.Outgoing as O
plugins {
kotlin(Plugins.KotlinJvm)
kotlin(Plugins.KotlinSerialization)
id("org.jetbrains.compose") version "0.4.0"
}
repositories {
jcenter()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
@alexandrepiveteau
alexandrepiveteau / Sites.kt
Created July 4, 2021 20:17
Additional builders for `MutableSite` with mutable backing model
inline fun <R, M, reified T, reified C> mutableSite(
identifier: SiteIdentifier,
initial: M,
projection: TwoWayProjection<M, T, C>,
vararg events: Pair<EventIdentifier, T>,
transform: (M) -> R,
): MutableSite<T, R> = TODO()
inline fun <R, M, reified T> mutableSite(
identifier: SiteIdentifier,
@alexandrepiveteau
alexandrepiveteau / ScanTransform.kt
Created April 1, 2021 09:12
An operator that combines scan(...) and transform { ... } for Kotlin flows
/**
* Applies [transform] function to each value of the given flow.
*
* The receiver transforms is [FlowCollector] and thus [transform] is a flexible block which can
* transform the given element, skit it or emit multiple elements.
*
* Additionally, this transform is stateful : each time an item is processed, it is transformed and
* passed around for the next invocations of [transform].
*
* @param T the type of the elements of the given flow.
@alexandrepiveteau
alexandrepiveteau / ex5.scala
Last active March 30, 2021 13:22
Série 3, exercices 5-6-7 (Simon FLÜCKIGER, Olivier Roméo DJEULEZECK TAMEGUI, Guillaume VALVONA, Alexandre PIVETEAU, Guy-Laurent SUBRI)
// Exercice 5
//
// En utilisant foldLeft (ou foldRight) écrivez une fonction reverse pour
// inverser l’ordre des éléments d’une liste.
def reverse[A](list: List[A]): List[A] =
list.foldLeft(List.empty[A])((xs, x) => x :: xs)
// Exemples :
//
@alexandrepiveteau
alexandrepiveteau / CodeEditor.elm
Created November 27, 2020 18:35 — forked from lukewestby/CodeEditor.elm
The custom element and Elm API that will drive Ellie's code editors
module Ellie.Ui.CodeEditor
exposing
( Attribute
, LinterMessage
, Position
, Severity(..)
, linterMessages
, mode
, onChange
, readOnly
@alexandrepiveteau
alexandrepiveteau / RequestManager.kt
Created November 15, 2020 14:49
A better coroutine-based HTTP requests manager
package ch.heigvd.iict.sym.labo2.betterComm
import ch.heigvd.iict.sym.labo2.betterComm.RequestManager.Backoff
import ch.heigvd.iict.sym.labo2.betterComm.RequestManager.ResponseOrCancelled.Cancelled
import ch.heigvd.iict.sym.labo2.betterComm.RequestManager.ResponseOrCancelled.Success
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.withContext
/**