I hereby claim:
- I am ivanobulo on github.
- I am ivanobulo (https://keybase.io/ivanobulo) on keybase.
- I have a public key whose fingerprint is A6C0 72C6 6ABF 6A4B BAFA 4DB3 4696 ACE5 EA4C B3F1
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
package eventsourcing | |
import java.time.Instant | |
import cats._ | |
import cats.data.EitherK | |
import cats.free.{Free, InjectK} | |
import cats.implicits._ | |
import doobie.imports._ | |
import fs2.Stream |
trait KafkaAvroSerde[T] { | |
def keySerde: Serde[T] | |
def valueSerde: Serde[T] | |
} |
object SerdeImplicits { | |
implicit def consumedAuto[K, V](implicit kSerde: KafkaAvroSerde[K], vSerde: KafkaAvroSerde[V]): Consumed[K, V] = ??? | |
implicit def producedAuto[K, V](implicit kSerde: KafkaAvroSerde[K], vSerde: KafkaAvroSerde[V]): Produced[K, V] = ??? | |
} |
def writeAll[K : KafkaAvroSerde, V : KafkaAvroSerde](driver: TopologyTestDriver, records: Seq[(K, V)])( | |
implicit recordFactory: ConsumerRecordFactory[K, V] | |
) = ??? |
def writeAll[K, V](driver: TopologyTestDriver, records: Seq[(K, V)])( | |
implicit recordFactory: ConsumerRecordFactory[K, V] | |
) = ??? |
import scala.sys.process._ | |
lazy val ecrCallerId = settingKey[String]("AWS caller ID") | |
ecrCallerId in ThisBuild := { | |
val os = new java.io.ByteArrayOutputStream | |
("aws sts get-caller-identity --output text" #> os).! | |
os.close() | |
val output = os.toString.trim | |
output.takeWhile(_ != '\t') |
lazy val ecrGetLogin = taskKey[Unit]("Login to ECR") | |
ecrGetLogin in ThisBuild := { | |
val os = new java.io.ByteArrayOutputStream | |
(s"aws ecr get-login --no-include-email --registry-ids ${ecrCallerId.value}" #> os).! | |
os.close() | |
// this will run 'docker login ...' that 'aws ecr get-login' have returned | |
os.toString.! | |
} |
def buildLine(words: Vector[String], maxWidth: Int, wordsWidth: Int): String = { | |
val spacePlacements = words.size - 1 | |
val missingSpaces = maxWidth - wordsWidth | |
val numSpace = missingSpaces / Math.max(spacePlacements, 1) | |
val remSpaces = missingSpaces % Math.max(spacePlacements, 1) | |
words.zipWithIndex.foldLeft(new StringBuffer()) { case (buf, (word, pos)) => | |
buf.append(word) | |
if (pos == 0 || pos < words.size - 1) { // first or not last | |
buf.append(Array.fill(numSpace + (if (pos < remSpaces) 1 else 0))(' ')) |
def justify(words: Array[String], maxWidth: Int): Vector[String] = { | |
val (lines, lastWords, width) = words.foldLeft((Vector.empty[String], Vector.empty[String], 0)) { | |
case ((resultLines, wordAcc, currentLineLen), word) => | |
if ((currentLineLen + word.length + (wordAcc.size - 1)) < maxWidth) { | |
(resultLines, wordAcc :+ word, currentLineLen + word.length) | |
} else { | |
val line = buildLine(wordAcc, maxWidth, currentLineLen) | |
(resultLines :+ line, Vector(word), word.length) | |
} | |
} |