Skip to content

Instantly share code, notes, and snippets.

View valencik's full-sized avatar
🍍

Andrew Valencik valencik

🍍
View GitHub Profile
<li class="indented0" name="fs2.Stream.InvariantOps#observe" group="Ungrouped" fullcomment="yes" data-isabs="false" visbl="pub">
<a id="observe(p:fs2.Pipe[F,O,Nothing])(implicitF:cats.effect.Concurrent[F]):fs2.Stream[F,O]" class="anchorToMember"></a><a id="observe(Pipe[F,O,Nothing])(Concurrent[F]):Stream[F,O]" class="anchorToMember"></a>
<span class="permalink">
<a href="../fs2/Stream$$InvariantOps.html#observe(p:fs2.Pipe[F,O,Nothing])(implicitF:cats.effect.Concurrent[F]):fs2.Stream[F,O]" title="Permalink"><i class="material-icons"></i></a>
</span>
<span class="modifier_kind"><span class="modifier"></span> <span class="kind">def</span></span>
<span class="symbol">
<span class="name">observe</span>
<span class="params">
(
@valencik
valencik / lucene-quick.sc
Created April 7, 2023 12:27
Quick Lucene InMemory example
//> using scala "2.13.10"
//> using lib "org.apache.lucene:lucene-core:9.5.0"
//> using lib "org.apache.lucene:lucene-analysis-common:9.5.0"
//> using lib "org.apache.lucene:lucene-memory:9.5.0"
//> using lib "org.apache.lucene:lucene-queryparser:9.5.0"
import org.apache.lucene.analysis.standard.StandardAnalyzer
import org.apache.lucene.index.memory.MemoryIndex
import org.apache.lucene.queryparser.flexible.standard.StandardQueryParser
@valencik
valencik / JsonlPayloadPipe.scala
Created July 9, 2024 20:19
Elasticsearch Bulk Indexing with a stream of JSON strings
import cats.effect.IO
import fs2.{Pipe, Pull, Stream}
object JsonlPayloadPipe {
/** Builds a pipe that transforms a stream of JSON strings into payloads for the Elasticsearch Bulk
* API. Each input string represents a JSON document to be sent to the Bulk API. The JSONs are
* gathered, interspersed with `delimiter`, and packaged into payload strings up to a maximum
* size of `batchMax` bytes.
*
@valencik
valencik / input-grid.html
Created September 3, 2025 17:00
Simple 28x28 input grid
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>28x28 Input Grid</title>
<style>
body {
font-family: Arial, sans-serif;