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.effect.IO | |
import cats.effect.unsafe.implicits.global | |
import cats.syntax.all.* | |
import cats.{Applicative, Eval} | |
import org.scalatest.flatspec.AnyFlatSpec | |
import org.scalatest.matchers.should.Matchers | |
class EvalApplicativeBug extends AnyFlatSpec with Matchers { | |
// Number of traversal iterations |
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.effect.kernel.{Outcome, Resource} | |
import cats.effect.unsafe.implicits.global | |
import cats.effect.{IO, Sync} | |
import cats.syntax.all.* | |
import com.typesafe.config.{Config, ConfigValueFactory} | |
import kamon.Kamon | |
import kamon.context.Storage.Scope | |
import kamon.trace.Span | |
import org.scalatest.flatspec.AnyFlatSpec | |
import org.scalatest.matchers.should.Matchers |
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.Alternative | |
import cats.kernel.Semigroup | |
import cats.syntax.all._ | |
// Concrete structure, deep embedding (initial encoding). | |
// Represents something like a dictionary or key-value store. | |
type MyStruct = List[(String, Int)] | |
val myStruct: MyStruct = List(("a", 1), ("b", 2), ("c", 3)) | |
// This are not desugared list constructors but operations on List. But ok, looks similar. | |
val myStruct: MyStruct = ("a", 1) +: ("b", 2) +: ("c", 3) +: List() |
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.annotation.tailrec | |
import cats.Eval | |
import cats.syntax.all._ | |
/** Testing lazy evaluation of connectiveUsed for ParMetaData. */ | |
final class ParMetaData(val connectiveUsed: Eval[Boolean]) | |
/** Par with metadata. */ | |
sealed trait Par { | |
protected def meta: ParMetaData |
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.FlatMap | |
/** | |
* 1. You don't need to make assumptions on what is the type of the robot action (that its Either in your case), | |
* just tell that it is a type constructor. [_] says this T is a higher kinded type - type depending on other type | |
* Which means it can bear internal state (this is how I understand and interpret it for myself). | |
* | |
* 2. Why you want to mix drawing capability with moving capability_ | |
* Better separate concerns and make type class that defines moving behaviour. | |
*/ |
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
def findPartition( | |
base: Set[M], // current final fringe | |
childrenF: M => List[M], // children function | |
senderF: M => S, // sender function | |
highestF: List[M] => M, // find highest message across (those seeing all others) | |
jssF: M => Set[M], // justifications | |
isSupermajority: Set[S] => Boolean | |
): Option[Set[S]] = { | |
// Compute the next level |
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
RNODE_DIR=/rchain | |
RNODE_JAVA_CONFIG=-XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/var/lib/rnode/heapdump_OOM.hprof -XX:+ExitOnOutOfMemoryError -XX:ErrorFile=/var/lib/rnode/hs_err.log -Dlogback.configurationFi> | |
#-XX:MaxRAMPercentage=75 -XX:MaxDirectMemorySize=1g | |
#-XX:ActiveProcessorCount=6 | |
# | |
RNODE_RUN_CONFIG=run -c /var/lib/rnode/rnode.conf --network-id llbm-testnet220729 --shard-name llbm-testnet --bootstrap rnode://98605e3b71f32b78ff3d55eaba96ff1e49888226@node0.llbm.testnet.rchain> | |
#--api-max-blocks-limit=3 | |
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
1. To spin up an instance of rabbitMQ: `docker run -d -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.9-management` | |
2. Open port 5672 to allow API calls. | |
3. To be able to access management GUI publish port 15672, by default management server is binded to localhost. It is accessible via web browser. | |
4. Use web GUI or https://www.rabbitmq.com/management-cli.html to manage exchanges, queues, topics from CLI. | |
5. The zero dependency way to talk to rabbitMQ after exchanges and queues are created is to use HTTP API via curl. | |
https://rawcdn.githack.com/rabbitmq/rabbitmq-server/v3.10.6/deps/rabbitmq_management/priv/www/api/index.html | |
https://dev.to/valanto/sending-a-rabbitmq-message-with-json-payload-using-curl-3l4k | |
Also various clients are available https://github.com/rabbitmq/rabbitmq-tutorials | |
So to sum up. |
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
new claim3n, processRecord in { | |
// return channel, map {"LOCAL": <list of keys in local map>}, contract to process a single record | |
contract claim3n(ret, processRecord) = { | |
let | |
// these two values are parsed from gentran mapping rules file from branching and input records section | |
branching <- [("", "LOCAL"),("", "CLAIM3N"),("CLAIM3N", "EDI_DC"),("CLAIM3N", "E1EDK01"),("CLAIM3N", "E2EDK14"),("CLAIM3N", "E2EDK03"),("CLAIM3N", "TEMP_E2EDK03"),("CLAIM3N", "E1EDKA1"),("E1EDKA1", "E2EDKA1"),("CLAIM3N", "TEMP_KA1"),("CLAIM3N", "E2EDK02"),("CLAIM3N", "E2EDK17"),("CLAIM3N", "E2EDK18"),("CLAIM3N", "E2EDP01"),("E2EDP01", "E2EDP01:2"),("E2EDP01", "Z2EDP01"),("E2EDP01", "E2EDPO3"),("E2EDP01", "TEMP_E2EDPO3"),("E2EDP01", "E2EDP20"),("E2EDP01", "E1EDP19"),("E2EDP01", "TEMP_E1EDP19"),("CLAIM3N", "E2EDS01:2")]; | |
records <- {"LOCAL": ["INP", "OUTP", "ORT02", "LIFNR"]}.union({"E2EDPO3": ["HLEVEL_colon_13", "PSGNUM_colon_13", "DATUM_colon_2", "DOCUM_colon_13", "IDDAT_colon_4", "UZEIT_colon_2", "MANDT_colo |
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 History { | |
val emptyRootHash: Blake2b256Hash = RadixHistory.emptyRootHash | |
def create[F[_]: Concurrent: Sync: Parallel]( | |
root: Blake2b256Hash, | |
store: KeyValueStore[F] | |
): F[RadixHistory[F]] = RadixHistory(root, RadixHistory.createStore(store)) | |
type KeyPath = Seq[Byte] | |
type KeyWord = Byte |
NewerOlder