Skip to content

Instantly share code, notes, and snippets.

View ahaxu's full-sized avatar

AhaXu ahaxu

View GitHub Profile
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDTPf+VhJlcgpwwlQ+T6IgMOPphjP33mUKrFBxZXEWsA96zw8AqHVYCdgJ7/CJUB/xet9y4LDXcGBhn33HPKZSzgm/lq0YtxifGcX3LZeCVQSffNKLd5e25Hicdx+3hKwQxmS82wlHeyTjeeOuSvChKuBtc0SuLixzU6AY92KR1uuLLdvW2OQ7v/ykeRxoXAtst5pUfzhYbFDw1PBh99JVXQfGhlhUX8T0JtbTedN9u9CbzcfqyZK8svTSzkS7EnwjTUbAIP0NLDC3hQuiPlgfIb8qql4A7Rg+bOx5+YEchaQHtp9xZX2w1IkQN/iy15lllqiLEkywhXeEubTBk3m3MRH8JImUAc7oMhQuK3f5+C+/3/ALMgUFSYW43CME3aEwtPKhwVgsxUTw5qMBNbHOH2IRvDj4/a6ahkxdNPZPnLcWsZRkztUuIMjAQkuNMfh/Puz8w7iL0mviT6P5WTO5wfESbete7JxzPgrWqKWhaFMz4HqE3UcyMxrEvqYyUO4k= longka@longka
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCno975hxngmr+I03zV2n34f3bECej+fFV0IDY2A5gN6G1K+HGfAYsYEFdtgp1vtQTG133miI0CsVdxp3qGqu/R6e/nbLBo2n1G8Aoiwl8PhO9xlZqXyYA4DHRBaUjaDu4+1iigJbMGiYc40blfH2Rp3azDnztNcsKVCRVJJlLGhuaisrhzNFORRBx0i4dN1RHDjwVJpZcYV+B+lZzCUk84vnhLZLmQYs1/m01HiKtFqiYcR82pZ7w/Fr/8rzjA1GzAfQNstsv43o63A+yAWjxrSnUX1DJ3NGbNzpG2LIU/mlW7qIYuMDrWFs4cAOUqrqz1B4lrldpiDowCSnwi+hP6x6QnORA5G5CNsSXLQFiaJrd0tsul8wKetG4+S7wFgQgKS0Rx3hRJu+p7B7XTXQWEj3vygkNu7pYQUTCIP2QN4FvnkPfJxyHYMYTBgEVXfrWqyyIUhER7c89pljcRtvlUj8gLn+8LjAjkMpyutU6xbd0nYnNghsO1m9PdHGCXWbk= longka@longka
@ahaxu
ahaxu / haskell-reader-exercise.hs
Last active November 16, 2021 02:46
Haskell reader excercise
{-# LANGUAGE InstanceSigs #-}
module LearnReader where
import Control.Applicative
import Data.Char
{--
Chapter 22 Haskell Programming From First Principle
Exercise page 809
@ahaxu
ahaxu / cardano-node-cert-rotate-kes.sh
Created November 17, 2021 05:38
Cardano node - rotate KES key
#!/bin/bash
# check zip in xxx
# usage:
# ./rotate-kes.sh \
# /path-to/kes.vkey \
# /path-to/cold.skey \
# /path-to/cold.counter
if [ -z "$1" ]
then
@ahaxu
ahaxu / haskell_ffp_readerT.hs
Last active December 5, 2021 12:27
ReaderT excercises
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE InstanceSigs #-}
module ExMonadTrans1 where
-- Todo
-- implement eitherT
-- implement readerT
-- implement stateT
-- implement maybeT
@ahaxu
ahaxu / haskell-combine-readerT-MaybeT.hs
Created December 5, 2021 02:34
Combination of readerT and maybeT
module CombineMonadT where
import Control.Monad.Trans
import Control.Monad.Trans.Maybe
import Control.Monad.Trans.Reader
getName :: MaybeT (ReaderT String IO) String
getName = MaybeT $ do
input <- ask
lift $ putStrLn input
@ahaxu
ahaxu / monoid1.hs
Last active March 17, 2022 07:11
How useful of monoid is
-- How Monoids are useful in Programming?
-- credit to https://www.youtube.com/watch?v=BovTQeDK7XI
module XMain where
import Data.Char
import Data.Monoid
import Data.Foldable
isValid :: Char -> Bool
@ahaxu
ahaxu / make_ctrl_k_interupt_cmd_in_terminal.md
Created February 15, 2022 12:37
Make Ctrl+K interrupt command in terminal
@ahaxu
ahaxu / burn.sh
Last active September 9, 2022 20:27
cardano burn token bash script
# Usage:
# $ ./burn.sh $tokenName $payment_address $policy_script_file_path
#
# For eg:
# $ ./burn.sh AhaXuTokenName `cat payment.addr` policy.script
#
# For list of token (for eg token.list) as below
# AAA
# BBB
# CCC
@ahaxu
ahaxu / metadata.json
Created February 21, 2022 03:02
Purchase
{"valueParameterInfo":[["Price",{"valueParameterFormat":{"contents":[6,"₳"],"tag":"DecimalFormat"},"valueParameterDescription":"The price of the item."}]],"slotParameterDescriptions":[["Payment deadline","The _**buyer**_ must pay the _price_ of the item by this time, otherwise the contract is cancelled."],["Complaint deadline","The _**buyer**_ can only complain until this deadline, otherwise the contract will assume the transaction went smoothly and pay the _**seller**_."],["Complaint response deadline","If the _**buyer**_ complained, the _**seller**_ must respond before this deadline, otherwise the contract will assume there was a problem with the transaction and refund the _**buyer**_."],["Mediation deadline","If the _**buyer**_ and the _**seller**_ disagree, the _**mediator**_ must weigh in before this deadline, otherwise the contract will assume there was a problem with the transaction and refund the _**buyer**_."]],"roleDescriptions":[["Buyer","The buyer of the item."],["Mediator","The mediator decides w