Skip to content

Instantly share code, notes, and snippets.

View sirlensalot's full-sized avatar

Stuart Popejoy sirlensalot

View GitHub Profile
use autodie;
use strict;
use Data::Dump 'dump';
use autodie;
open my $fh, '<:raw', 'dreamy-r8.syx';
my @data=();
my @asounds,my @acopy, my @arom,my @aperf,my @afeel,my @aassign,my @aoutput,my @amidi,my @asystem;
my $area = -1;
@sirlensalot
sirlensalot / migrate.repl
Created August 31, 2021 17:10
Pact schema upgrade
(begin-tx)
(module m g
(defcap g () true)
(defschema s
a:string
)
(deftable t:{s})
(defun add (k:string a:string)
(insert t k { 'a: a })
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"blockHash": "0xdcc2a8a430bca58e16783ab3aa2287ad6c8c3a27cdcf254519d55d03d92d698b",
"blockNumber": "0xa8b5a3",
"contractAddress": null,
"cumulativeGasUsed": "0xadb611",
"from": "0xa37e46fda154bb2152b1110c46a2287bac8da6e1",
# ---------- Buyer
@sirlensalot
sirlensalot / PlatedScope.hs
Created September 29, 2020 04:30
Plated scope
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
module Pact.Types.Plated where
import Control.Lens.Plated
@sirlensalot
sirlensalot / hello-world-edits.pact
Created June 5, 2019 21:54
Pact shared with pact-web.
;;
;; "Hello, world!" smart contract/module
;;
;; To try it out, click "Load into REPL" and type into the repl:
;; pact> (hello-world.greet)
;;
;; Check lines 21 and 34 to play with Formal Verification
;;
;; Define the module.
@sirlensalot
sirlensalot / payments-3.0.pact
Created May 30, 2019 18:44
Pact shared with pact-web.
;;
;; Pact Example: "payments", a simple cash ledger.
;;
(module payments MODULE_ADMIN
; no-op module admin for example purposes.
; in a real contract this could enforce a keyset, or
; tally votes, etc.
(defcap MODULE_ADMIN () true)
data HashAlgo
data SignatureAlgo
data PPKScheme' a where
ED25519' :: PPKScheme' ED25519Scheme
ETH' :: PPKScheme' ETHScheme
deriving instance Show a => Show (PPKScheme' a)
@sirlensalot
sirlensalot / Cont.hs
Created December 9, 2018 18:44
ContT experiment
{-# LANGUAGE DeriveFoldable #-}
{-# LANGUAGE DeriveTraversable #-}
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
import Control.Monad.Cont
import Control.Monad.Reader
import Control.Monad.IO.Class
import qualified Data.Map.Strict as M
benchmarking parse/longStr 10
time 1.788 μs (1.762 μs .. 1.814 μs)
0.997 R² (0.996 R² .. 0.999 R²)
mean 1.813 μs (1.781 μs .. 1.845 μs)
std dev 106.6 ns (86.11 ns .. 133.5 ns)
variance introduced by outliers: 72% (severely inflated)
benchmarking parse/longStr 100
time 5.493 μs (5.374 μs .. 5.591 μs)
0.997 R² (0.995 R² .. 0.998 R²)
.stack-work/dist/x86_64-osx/Cabal-1.24.2.0/build/bench/bench compile
Array [String "Write succeeded"]
Array [String "Write succeeded"]
Array [String "Write succeeded"]
benchmarking compile/longStr 10
time 370.0 ns (365.6 ns .. 374.8 ns)
0.999 R² (0.998 R² .. 0.999 R²)
mean 367.9 ns (362.6 ns .. 372.9 ns)
std dev 17.24 ns (13.55 ns .. 22.40 ns)
variance introduced by outliers: 65% (severely inflated)