Skip to content

Instantly share code, notes, and snippets.

@ilap
ilap / epoch_rewards.md
Last active February 9, 2023 14:43
Epoch Rewards

Zsh script

#!/usr/bin/env zsh
# 
# usage:
# epoch_rewards.sh {317..390}
# or
# epoch_rewards.sh 390
@ilap
ilap / plot_rss.md
Last active April 27, 2023 00:43
Plot RSS with and without cost

Plot RSS with and without cost

#!/usr/bin/env python3

import math

import matplotlib.pyplot as plt
@ilap
ilap / pledge_model.py
Created November 13, 2022 00:28
Cardano's RSS Simulation - Pledge Model
#!/usr/bin/env python3
# Python implementation of Lars's Haskell based `pledge_model`.
# https://github.com/brunjlar/pledging-model
#
# Install:
# python -m pip install numpy argparse
import random
import numpy as np
import argparse
@ilap
ilap / recover_byron.md
Last active October 2, 2022 03:19
Recover Byron with permutations

Install

$ mkdir recover && cd recover
# 1. Save the recover.js javascript below as recover.js

# 2. Install prereqs
$ npm i cbor cardano-crypto.js@6.1.1

# 3. Create a password file with the password candidates, 1-per-line
@ilap
ilap / Playground.hs
Last active October 4, 2021 07:12
Plutus Playground Smart Contract
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
@ilap
ilap / Playground.hs
Created October 3, 2021 10:43
Plutus Playground Smart Contract
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
@ilap
ilap / Playground.hs
Last active October 2, 2021 23:23
Plutus Playground Smart Contract
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
@ilap
ilap / get_hydra_build.md
Last active May 24, 2022 08:35
Retrieve Hydra Build based on Git tag
@ilap
ilap / standalone_gLiveView.md
Last active August 4, 2021 05:06
Standalone gLiveView

Prerequisities

You must be able to run ss or lsof as root to gather the node-s PID in their ouput, as I HIGHLY DO NOT RECOMMEND running a node and this script as root.

The easiest way is just add simmilar entries as the following into the /etc/sudoers or create a file under /etc/sudoers.d/

The /etc/sudoers example, but pls ensure that the path to those files are correct:

User_Alias SPO=spo,ahtn,shmn
@ilap
ilap / Playground.hs
Last active February 7, 2021 09:54
Plutus Playground Smart Contract
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE TemplateHaskell #-}
import Control.Applicative (Applicative (pure))
import Control.Monad (void)
import Language.Plutus.Contract
import qualified Language.Plutus.Contract.Constraints as Constraints
import qualified Language.Plutus.Contract.Typed.Tx as Typed