Skip to content

Instantly share code, notes, and snippets.

View valdo404's full-sized avatar

Laurent Valdes valdo404

View GitHub Profile
@valdo404
valdo404 / recoverable.scala
Created October 9, 2023 17:49
test-recoverable
case class Recoverable[A](errors: Seq[Throwable], a: Option[A]) {
def map[B](f: A => B): Recoverable[B] = {
val b = a.map(f)
Recoverable(errors, b)
}
def flatMap[B](f: A => Recoverable[B]):
Recoverable[B] = {
val result: Option[Recoverable[B]] = a.map(f)
result match {
@valdo404
valdo404 / tailrec.md
Last active September 27, 2023 21:05
tail recursion
  • Thématique: En Scala, l'annotation @tailrec est utilisée pour informer le compilateur qu'une optimisation de la récursion en queue est attendue.
  • Aspect technique: Si le compilateur détecte qu'une optimisation n'est pas possible, il renverra une erreur de compilation. Ce mécanisme assure que le développeur est conscient des implications de performance de son code.
  • Thématique: Une introduction complète aux appels en queue, leur importance dans la programmation fonctionnelle, et comment différents langages gèrent ces appels.
  • Aspect technique: La récursion en queue peut être optimisée en un saut d'instruction au lieu d'un appel de fonction complet, économisant ainsi de l'espace de pile.
  • Thématique: La corecursion est essentiellement la ré
@valdo404
valdo404 / requirements.txt
Last active August 2, 2023 12:41
Some haystack test
farm-haystack[all,inference]==1.19.0
Flask-SQLAlchemy
torch
sentence-transformers
@valdo404
valdo404 / gist:b1f0034c3d61a594db1abc5602645db8
Last active July 25, 2023 20:26
CV continuously deployed

Putting your CV under Continuous Deployment

In this era of digital advancement, why not put your CV under continuous deployment? This way, you can always keep your CV up-to-date and readily available for any potential opportunity. This post guides you through the process of putting your CV under continuous deployment using GitHub Actions.

Step 1: Making the Most of LaTeX

LaTeX is a high-quality typesetting system and in our case, we are using two particular document classes - Beamer for presentations and moderncv for the CV.

Moderncv

import shapeless._
import shapeless.record._
import shapeless.labelled._
import shapeless.syntax.singleton._
type BookRecord = FieldType[Witness.`"author"`.T, String] ::
FieldType[Witness.`"title"`.T, String] ::
FieldType[Witness.`"id"`.T, Double] ::
FieldType[Witness.`"price"`.T, Double] ::
HNil
import cats.effect.{ExitCode, IO, IOApp, Resource}
import com.sksamuel.pulsar4s.{Consumer, ConsumerConfig, ConsumerMessage, Producer, ProducerConfig, PulsarClient, PulsarClientConfig, Subscription, Topic}
import com.sksamuel.pulsar4s.fs2.{CommittableMessage, PulsarStreams}
object PulsarTest extends IOApp {
import com.sksamuel.pulsar4s.circe._
import io.circe.generic.auto._
val intopic = Topic("persistent://sample/standalone/ns1/in")
val outtopic = Topic("persistent://sample/standalone/ns1/out")
/* =SENAT_ALIREAUSSI
----------------------------------------------------------------------------- */
var senat_alireaussi = {
url: "/themes/xml/alireaussi.xml",
mainSelector: "#box-documents .box-inner",
topSelector: "#box-documents",
list1: ".box .box-inner .list-documents:eq(0)",
list2: ".box .box-inner .list-documents:eq(1)",
[valdo404@Host-001 ~]$ rping -s -C 10 -v
server ping data: rdma-ping-0: ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqr
server ping data: rdma-ping-1: BCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrs
server ping data: rdma-ping-2: CDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrst
server ping data: rdma-ping-3: DEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstu
server ping data: rdma-ping-4: EFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuv
server ping data: rdma-ping-5: FGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvw
server ping data: rdma-ping-6: GHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwx
server ping data: rdma-ping-7: HIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxy
server ping data: rdma-ping-8: IJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz
@valdo404
valdo404 / launch-spark.sh
Created May 10, 2019 10:21
Launch spark on brew installation
pushd /usr/local/Cellar/apache-spark/2.4.1/libexec/
./sbin/start-master.sh
./sbin/start-slave.sh localhost:7077
popd
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import javax.annotation.Nullable;
import java.util.concurrent.ExecutionException;
public class FuturesApp {
public static void main(String[] args) throws ExecutionException, InterruptedException {