Skip to content

Instantly share code, notes, and snippets.

@shmish111
shmish111 / gist:f0421a2149f994e70532
Created February 15, 2016 10:21
find dodgy chars
LC_ALL=C grep '[^ -~]'myfile.txt
def r1:
media_with_jpg_href = filter(lambda x: x[0].startswith('media') and 'jpg_href' in x[1], metadata.items())
return map(lambda y: y[1]['jpg_href'], media_with_jpg_href)
def r2 = (seq(metadata.items())
.filter(lambda x: x[0].startswith('media') and 'jpg_href' in x[1])
.map(lambda y: y[1]['jpg_href']))
@shmish111
shmish111 / Playground.hs
Created February 4, 2019 16:26
Plutus Playground Smart Contract
-- | Crowdfunding contract implemented using the [[Plutus]] interface.
-- This is the fully parallel version that collects all contributions
-- in a single transaction.
--
-- Note [Transactions in the crowdfunding campaign] explains the structure of
-- this contract on the blockchain.
import qualified Language.PlutusTx as PlutusTx
import qualified Ledger.Interval as Interval
import Ledger.Interval (SlotRange)
import qualified Language.PlutusTx.Prelude as P
@shmish111
shmish111 / Playground.hs
Created February 25, 2019 18:06
Plutus Playground Smart Contract
-- | Crowdfunding contract implemented using the [[Plutus]] interface.
-- This is the fully parallel version that collects all contributions
-- in a single transaction.
--
-- Note [Transactions in the crowdfunding campaign] explains the structure of
-- this contract on the blockchain.
import qualified Language.PlutusTx as PlutusTx
import qualified Ledger.Interval as Interval
import Ledger.Interval (SlotRange)
import qualified Language.PlutusTx.Prelude as P
@shmish111
shmish111 / Playground.hs
Created March 6, 2019 15:39
Plutus Playground Smart Contract
-- | A game with two players. Player 1 thinks of a secret word
-- and uses its hash, and the game validator script, to lock
-- some funds (the prize) in a pay-to-script transaction output.
-- Player 2 guesses the word by attempting to spend the transaction
-- output. If the guess is correct, the validator script releases the funds.
-- If it isn't, the funds stay locked.
import qualified Language.PlutusTx as PlutusTx
import qualified Language.PlutusTx.Prelude as P
import Ledger
import qualified Ledger.Ada as Ada
@shmish111
shmish111 / Playground.hs
Last active March 8, 2019 10:51
Plutus Playground Smart Contract
-- | A game with two players. Player 1 thinks of a secret word
-- and uses its hash, and the game validator script, to lock
-- some funds (the prize) in a pay-to-script transaction output.
-- Player 2 guesses the word by attempting to spend the transaction
-- output. If the guess is correct, the validator script releases the funds.
-- If it isn't, the funds stay locked.
import qualified Language.PlutusTx as PlutusTx
import qualified Language.PlutusTx.Prelude as P
import Ledger
import qualified Ledger.Ada as Ada
@shmish111
shmish111 / Playground.hs
Created April 11, 2019 12:00
Plutus Playground Smart Contract
-- | Vesting scheme as a PLC contract
import Control.Monad (void)
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Language.PlutusTx as P
import Ledger (Address, DataScript(..), RedeemerScript(..), Signature, Slot, TxOutRef, TxIn, ValidatorScript(..))
import qualified Ledger as L
import Ledger.Ada (Ada)
@shmish111
shmish111 / Playground.hs
Created April 11, 2019 12:07
Plutus Playground Smart Contract
-- | Vesting scheme as a PLC contract
import Control.Monad (void)
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Language.PlutusTx as P
import Ledger (Address, DataScript(..), RedeemerScript(..), Signature, Slot, TxOutRef, TxIn, ValidatorScript(..))
import qualified Ledger as L
import Ledger.Ada (Ada)
@shmish111
shmish111 / Playground.hs
Created April 16, 2019 08:09
Plutus Playground Smart Contract
-- | Vesting scheme as a PLC contract
import Control.Monad (void)
import qualified Data.Map as Map
import qualified Data.Set as Set
import qualified Language.PlutusTx as P
import Ledger (Address, DataScript(..), RedeemerScript(..), Signature, Slot, TxOutRef, TxIn, ValidatorScript(..))
import qualified Ledger as L
import Ledger.Ada (Ada)
@shmish111
shmish111 / Meadow.hs
Created June 4, 2019 10:31
Marlowe Smart Contract
module Escrow where
import Marlowe
{-# ANN module "HLint: ignore" #-}
main :: IO ()
main = putStrLn $ prettyPrint contract
-------------------------------------