Skip to content

Instantly share code, notes, and snippets.

@ismagin
ismagin / continuations-poc-blockchain.json
Created May 4, 2020 09:10
continuations-poc-blockchain.json
[
{
"blocksize": 688,
"signature": "5fKMzzXxVd3x8ZxjAugwBgpB4GavBEkw8Efyy3FsodvXMQ6zvWcZyXro3z87d3i3EYNxr16TueUHVCZnEPNEwLGN",
"fee": 0,
"generator": "3HPNckeuow7wxh9WEzAwMeyzrknvyVNhxTH",
"generatorPublicKey": "2eEUvypDSivnzPiLrbYEW39SM8yMZ1aq4eJuiKfs4sEY",
"transactions": [
{
"type": 1,
@ismagin
ismagin / continuations-poc-script.ride
Created May 4, 2020 09:10
continuations-poc-script.ride
{-# STDLIB_VERSION 4 #-}
{-# CONTENT_TYPE DAPP #-}
@Callable(inv)
func foo() = {
let a =
(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64''
@ismagin
ismagin / continuations-poc-script.ride
Created May 4, 2020 09:10
continuations-poc-script.ride
{-# STDLIB_VERSION 4 #-}
{-# CONTENT_TYPE DAPP #-}
@Callable(inv)
func foo() = {
let a =
(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64'')) then 0 else 1)+(if (sigVerify(base64'',base64'',base64''
@ismagin
ismagin / workshop.md
Last active September 10, 2019 10:57
Workshop Tools
package ex
import scodec.{Codec, codecs}
import scodec.codecs.{Discriminated, uint8}
object ASD extends App {
sealed trait Expr
case class INT(i: Int) extends Expr
case class SUM(i1: Expr, i2: Expr) extends Expr
@ismagin
ismagin / statefulGen.scala
Created June 28, 2017 12:31
StateT and Gen
// resolvers += "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
// libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0"
// libraryDependencies += "org.typelevel" %% "cats" % "0.9.0"
// libraryDependencies += "io.github.amrhassan" %% "scalacheck-cats" % "0.3.2" % Test
package ex
import cats._
@ismagin
ismagin / firstDifferentBlock.scala
Created May 24, 2017 14:35
Finds first different block betweeen two waves nodes
object LCB extends App {
def get(url: String) = scala.io.Source.fromURL(url).mkString
def blockAt(nodeHttp: String, blockHeight: Int) = get(nodeHttp + "/blocks/at/" + blockHeight)
def nodeComparator(node1: String, node2: String)(h: Int): Boolean = blockAt(node1, h) == blockAt(node2, h)
val TESTNET1 = "http://52.30.47.67:6869"
val TESTNET2 = "http://52.28.66.217:6869"
val TESTNET3 = "http://52.77.111.219:6869"
val TESTNET4 = "http://52.51.92.182:6869"
@ismagin
ismagin / io.scala
Last active April 11, 2017 07:05
IO Example
package ex
object EP extends App {
trait IO[A] { self =>
def run(): A
def _map[B](f: A => B): IO[B] = new IO[B] { override def run(): B = f(self.run()) }
def _flatMap[B](f: A => IO[B]): IO[B] = new IO[B] { override def run(): B = f(self.run()).run() }
}
@ismagin
ismagin / gist:a91f600cde5786bf1d30b3190b54187d
Last active June 8, 2016 22:41 — forked from bigsnarfdude/gist:b2eb1cabfdaf7e62a8fc
ubuntu 14.04 install scala 2.11.7 and sbt 13.9 and java 8 and git
# git install
sudo apt-get install git
# java install
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
# scala install