Skip to content

Instantly share code, notes, and snippets.

View fchaillou's full-sized avatar

Fabien Chaillou fchaillou

View GitHub Profile
@Swoorup
Swoorup / ActorK.scala
Last active July 17, 2023 19:54
Typed Actors using Cats Effect, FS2 and Deferred Magic
import cats.effect.syntax.all.*
import cats.syntax.all.*
import cats.effect.*
import fs2.Stream
import cats.effect.std.Queue
import scala.concurrent.duration.*
import lib.FSM
import lib.actor.{Actor, AskMsg}
@dacr
dacr / index.md
Last active May 11, 2025 11:26
David's programming examples knowledge base / published by https://github.com/dacr/code-examples-manager #fecafeca-feca-feca-feca-fecafecafeca/6e82bf2949cc61c919535ce35a58ebc93721c33

David's programming examples knowledge base

akka-pekko

@lihaoyi
lihaoyi / Test.scala
Created October 30, 2017 13:49
Resolving jars with Coursier and compiling Scala with the Zinc incremental compiler, in a self-contained Ammonite script
import play.api.libs.json.Json
object Main{
def main(args: Array[String]): Unit = {
println(
Json.prettyPrint(
Json.toJson(Seq("Hello", "World", "Cow"))
)
)
}

Applied Functional Programming with Scala - Notes

Copyright © 2016-2018 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@paulp
paulp / demo.sh
Last active June 8, 2018 09:16
Enabling sbt plugins from the command line in any sbt project
% sbtx dependencyGraph
... blah blah ...
[info] *** Welcome to the sbt build definition for Scala! ***
[info] Check README.md for more information.
[error] Not a valid command: dependencyGraph
[error] Not a valid project ID: dependencyGraph
% sbtx -Dplugins=graph dependencyGraph
... blah blah ...
// Disable VirtualBox authentication
VBoxManage setproperty websrvauthlibrary null
// Start SOAP service so REX-Ray can talk to VirtualBox from the container host VMs
/Applications/VirtualBox.app/Contents/MacOS/vboxwebsrv -H 0.0.0.0 -v
// Create a Swarm cluster
docker-machine create --driver=virtualbox default
eval $(docker-machine env default)
TOKEN=$(docker run --rm swarm create)
@jpallari
jpallari / ResponseCollector.scala
Last active October 20, 2020 10:13
Reusable response collector in Akka
package collector
import akka.actor._
import akka.util.Timeout
import scala.concurrent.duration._
import scala.concurrent.{Future, Promise}
trait ResponseTracker[T] {
def addResponse(response: T): ResponseTracker[T]
def isDone: Boolean
@stucchio
stucchio / UUIDToDoubleMapWritable.java
Created March 25, 2011 23:14
A specialized map to save overhead in hadoop
package stylewok.utils.writable;
import org.apache.hadoop.io.*;
import java.util.*;
import java.io.*;
public class UUIDToDoubleMapWritable extends HashMap<UUIDWritable,Double> implements Writable {
public UUIDToDoubleMapWritable() { }
@stucchio
stucchio / UUIDWritable.java
Created March 7, 2011 03:25
UUID Writable object - storage is half the size of storing UUID's as strings
import org.apache.hadoop.io.*;
import java.util.*;
import java.io.*;
public class UUIDWritable implements WritableComparable<UUIDWritable> {
private UUID value;
public UUIDWritable(long mostSignificantBits, long leastSignificantBits) {
value = new UUID(mostSignificantBits, leastSignificantBits);