Skip to content

Instantly share code, notes, and snippets.

// brew install amm
// amm cip30_debug.sc
import $ivy.`org.cardanofoundation:cip30-data-signature-parser:0.0.10`
import $ivy.`org.slf4j:slf4j-simple:2.0.9`
import org.cardanofoundation.cip30.CIP30Verifier
import java.util.Optional
import $ivy.`com.bloxbean.cardano:cardano-client-lib:0.5.0-alpha.4`
import $ivy.`com.bloxbean.cardano:cardano-client-backend-blockfrost:0.5.0-alpha.4`
import $ivy.`com.bloxbean.cardano:cardano-client-cip30:0.5.0-alpha.4`
import $ivy.`com.lihaoyi:requests_3:0.8.0`
import $ivy.`com.fasterxml.jackson.core:jackson-core:2.15.2`
import com.bloxbean.cardano.client.api.model.Amount
import com.bloxbean.cardano.client.crypto._
import com.bloxbean.cardano.client.account._
octave:25> fprintf('%.3f\n', (2^16))
65536.000
octave:26> fprintf('%.3f\n', (2^17))
131072.000
octave:27> fprintf('%.3f\n', (2^18))
262144.000
octave:28> fprintf('%.3f\n', (2^19))
524288.000
octave:29> fprintf('%.3f\n', (2^20))
1048576.000
use aiken/builtin
use aiken/bytearray
use aiken/hash.{Hash, Sha2_256}
use aiken/list
use aiken/string
// Merkle Tree in Aiken (ported from: https://github.com/input-output-hk/hydra/blob/master/plutus-merkle-tree/src/Plutus/MerkleTree.hs)
pub type MerkleTree<alg> {
// represents no value (null object pattern)
use aiken/hash.{Blake2b_224, Hash}
use aiken/interval.{Finite, Interval, IntervalBound, PositiveInfinity}
use aiken/list
use aiken/option
use aiken/transaction.{
Input, Output, OutputReference, ScriptContext, ScriptPurpose, Spend,
ValidityRange,
}
use aiken/transaction/credential.{
Address, Inline, PublicKeyCredential, Script, ScriptCredential,
@matiwinnetou
matiwinnetou / english_action.ak
Last active January 18, 2023 07:44
Aiken English Auction
use aiken/hash.{Blake2b_224, Hash}
use aiken/interval.{Finite, Interval, IntervalBound, PositiveInfinity}
use aiken/list
use aiken/option
use aiken/transaction.{
Input, Output, OutputReference, ScriptContext, ScriptPurpose, Spend,
ValidityRange,
}
use aiken/transaction/credential.{
Address, Inline, PublicKeyCredential, Script, ScriptCredential,
@matiwinnetou
matiwinnetou / time_lock.ak
Created January 4, 2023 14:34
Aiken's vesting contract
use aiken/hash.{Blake2b_224, Hash}
use aiken/interval.{Finite, Interval, IntervalBound}
use aiken/list
use aiken/transaction.{ScriptContext, Spend, ValidityRange}
use aiken/transaction/credential.{VerificationKey}
type POSIXTime =
Int
type PubKeyHash =
@matiwinnetou
matiwinnetou / pet-snippet.toml
Last active November 15, 2019 09:35
description
[[snippets]]
description = "ssh inet kokosz"
command = "ssh -A root@kokosz.nerdpol.ovh"
output = ""
[[snippets]]
description = "git fetch all"
command = "git fetch --all"
output = ""
import org.apache.lucene.analysis.de.GermanAnalyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.*;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.search.spell.LuceneDictionary;
import org.apache.lucene.search.spell.SpellChecker;
import org.apache.lucene.search.suggest.Lookup;
import org.apache.lucene.search.suggest.analyzing.AnalyzingSuggester;
@matiwinnetou
matiwinnetou / advent1.scala
Last active February 25, 2016 20:58
The simplest NON persisted event sourcing on planet earth
//http://adventofcode.com/day/1
object DayOne extends App {
val floorData: String = "(((())))()((((((((())()(()))(()((((()(()(((()((()((()(()()()()()))(((()(()((((((((((())(()()((())()(((())))()(()(()((()(()))(()()()()((()((()(((()()(((((((()()())()((((()()(((((()(())()(())((())()()))()(((((((())(()())(()(((())(()))((())))(()((()())))()())((((())))(()(((((()(())(((()()((()((()((((((((((())(()())))))()))())()()((((()()()()()()((((((())())(((()())()((()()(((()()()))(((((()))(((()(()()()(()(()(((())()))(()(((()((())()(()())())))((()()()(()()(((()))(((()((((()(((((()()(()())((()())())(()((((((()(()()))((((()))))())((())()()((()(()))))((((((((()))(()()(((())())(())()((()()()()((()((()((()()(((())))(()((())()((((((((()((()(()()(((())())())))(())())))()((((()))))))())))()()))()())((()())()((()()()))(()()(((()(())((((())())((((((((()()()()())))()()()((((()()))))))()((((()(((()))(()()())))((()()(((()))()()())())(((())((()()(())()()()(((())))))()())((()))()))((())()()())()())()()(()))())))())()))(())((()(())))(()(()