This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@dataclass | |
class InstanceGroups: | |
master_nodes: Ec2InstancesGroup | |
core_nodes: Ec2InstancesGroup | |
@dataclass | |
class InstanceFleets: | |
config: list[dict[str, any]] | |
subnets: set[KnownEc2Subnets] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package fs2 | |
import cats.Applicative | |
import cats.effect.kernel.{Fiber, Outcome} | |
import cats.effect.syntax.all._ | |
import cats.effect.{Concurrent, Deferred} | |
import cats.syntax.all._ | |
import fs2.concurrent.{Channel, SignallingRef} | |
import fs2.internal.Scope | |
import tmp.Queue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.collection.generic.IsIterable | |
import scala.collection.{BuildFrom, IterableOps} | |
import scala.language.implicitConversions | |
// Пример для одной конкретной коллекции, рабочий | |
object ListUtils { | |
implicit class ListOps[A](val self: List[A]) extends AnyVal { | |
def unNone[B](implicit ev: A <:< Option[B]): List[B] = { | |
ev.liftCo(self).collect { | |
case Some(x) => x |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Summon `Read[A]` instance for case class `A` with default parameters. | |
* {{{ | |
* case class A(a: String, b: Boolean = false) | |
* implicit val aRead: Read[A] = readWithDefaults[A]() | |
* }}} | |
*/ | |
class readWithDefaults[A] { | |
def apply[ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.concurrent.atomic.AtomicReference | |
import org.scalacheck.rng.Seed | |
import scala.annotation.tailrec | |
import scala.util.Try | |
class GlobalSeed(initial: Seed) extends Seed { | |
private val current = new AtomicReference[Seed](initial) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.Applicative | |
import cats.data.NonEmptyList | |
import cats.effect.Concurrent | |
import cats.effect.concurrent.{Deferred, Ref} | |
import cats.implicits._ | |
import fs2.concurrent.{InspectableQueue, SignallingRef} | |
import fs2.{Chunk, CompositeFailure, Scope, Stream} | |
object StreamPriorityUtils { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2.1' | |
services: | |
zookeeper: | |
image: wurstmeister/zookeeper | |
ports: | |
- "32181:2181" | |
healthcheck: | |
test: "./bin/zkServer.sh status" | |
interval: 5s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package monix.eval | |
import scala.concurrent.{Await, ExecutionContext, Future} | |
import scala.concurrent.duration._ | |
object Test extends App { | |
object LazyFuture { | |
def delay[A](body: => A): LazyFuture[A] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shapeless._ | |
import shapeless.record._ | |
case class User( | |
id: Long, | |
name: String, | |
age: Int | |
) | |
val user = User(15L, "Test", 25) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object MatrixPermutations { | |
def main(args: Array[String]): Unit = { | |
val in = List( | |
List(1,2), | |
List(3,4), | |
List(5,6), | |
) | |
def findAllPermutations[T](matrix: List[List[T]]): List[List[T]] = { |
NewerOlder