Skip to content

Instantly share code, notes, and snippets.

import cats.effect.concurrent.{Deferred, Ref}
import cats.effect.{ExitCode, IO, IOApp}
import fs2.Chunk
import scala.concurrent.duration._
import scala.util.Random
object FS2Test extends IOApp {
@hanny24
hanny24 / monix-oom.scala
Created September 10, 2019 07:42
Monix OOM
import cats.effect._
import monix.eval.Task
import monix.execution.Scheduler
import org.http4s.HttpApp
import org.http4s.server.Server
import org.http4s.server.blaze.BlazeServerBuilder
import scala.concurrent.ExecutionContext
function leven_damerau(a::AbstractVector, b::AbstractVector, width::Int, fill_fun)
a_n = length(a)
b_n = length(b)
n = max(a_n,b_n)
tmp = Array(Int,n+1,width)
idx = [i for i in 1:width]
for i in 1:n+1
tmp[i, idx[width] - 1] = i-1
for j in 1:width - 2
@hanny24
hanny24 / recoll.py
Created September 9, 2013 18:16
Quick & dirty recoll support for Kupfer. Just place it to ~/.local/share/kupfer/plugins.
# Heavily based on Locate plugin by Ulrik Sverdrup <[email protected]>
__kupfer_name__ = _("Recoll")
__kupfer_actions__ = (
"Recoll",
)
__description__ = _("Search using Recoll")
__version__ = ""
__author__ = "Honza Strnad <[email protected]>"
@hanny24
hanny24 / comp.rs
Created June 10, 2013 15:31
Simple Scala-like for comprehension for rust
// Simple Scala-like for comprehension for rust
macro_rules! comp(
// base case, using "map"
(val $id:ident <- $expr:expr $(,if $cond:expr)* $(,let $assign_id:pat = $assign_val:expr)* ,yield $comp:expr) =>
(
($expr)$(.filtered(|&$id| $cond))*.map(|&$id| {
$(let $assign_id = $assign_val;)* $comp
}
)