Skip to content

Instantly share code, notes, and snippets.

@rrevol
rrevol / FlinkDeadlockTest.scala
Created February 20, 2018 15:01
Small test reproducing a deadlock in Flink
import org.apache.flink.streaming.api.functions.source.SourceFunction
import org.apache.flink.streaming.api.scala.{StreamExecutionEnvironment, _}
object FlinkDeadlockTest {
val MAX_LOOP_NB = 10
def main(args: Array[String]): Unit = {
val env = StreamExecutionEnvironment.getExecutionEnvironment
env.addSource(new SourceFunction[Int] {
var goOn = true
@rrevol
rrevol / gist:31663c6130a853d43736b13818d9b733
Created December 3, 2016 17:53 — forked from michaeldorner/gist:746c659476429a86a9970faaa6f95ec4
An FM Synthesizer in Swift using AVAudioEngine
import AVFoundation
import Foundation
// The single FM synthesizer instance.
private let gFMSynthesizer: FMSynthesizer = FMSynthesizer()
public class FMSynthesizer {
@rrevol
rrevol / FlatMapVSConcatMapTest.java
Last active July 15, 2016 12:41
In RxJava : Highlighting of an unexpected difference between flatmap and concatmap when the incoming stream has only one element
import java.util.*;
import java.util.function.*;
import rx.Observable;
import rx.functions.Func1;
import rx.observers.TestSubscriber;
import static rx.Observable.*;
import static rx.internal.util.UtilityFunctions.identity;
import static rx.schedulers.Schedulers.*;
@rrevol
rrevol / CacheTest.java
Created February 10, 2016 14:18
Test of guava cache stats coherency
import java.util.*;
import java.util.concurrent.*;
import com.google.common.cache.Cache;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheStats;
import static com.google.common.base.Preconditions.checkState;
import static com.google.common.base.Throwables.propagate;
import static java.util.concurrent.Executors.*;
@rrevol
rrevol / jargon.md
Last active August 29, 2015 14:27 — forked from cb372/jargon.md
Category theory jargon cheat sheet

Category theory jargon cheat sheet

A primer/refresher on the category theory concepts that most commonly crop up in conversations about Scala or FP. (Because it's embarassing when I forget this stuff!)

I'll be assuming Scalaz imports in code samples, and some of the code may be pseudo-Scala.

Functor

A functor is something that supports map.