Skip to content

Instantly share code, notes, and snippets.

View krisajenkins's full-sized avatar
💭
:: Geek

Kris Jenkins krisajenkins

💭
:: Geek
View GitHub Profile
@krisajenkins
krisajenkins / extract_mp3_from_mp4
Last active April 16, 2024 10:10
A simple script to pull mp3s out of mp4s.
#!/bin/sh
usage() {
(
if [[ $# -ne 0 ]]
then
echo $*
echo
fi
echo "USAGE: `basename $0` <input.mp4>"
@krisajenkins
krisajenkins / Lib.hs
Created November 10, 2022 16:49
Huffman Encoding in Haskell (or the beginnings of it, at least)
{-# LANGUAGE ScopedTypeVariables #-}
module Lib
( toBasicTree,
toTree,
sortTreeList,
weight,
Tree (..),
)
where
@krisajenkins
krisajenkins / .emacs.el
Created June 27, 2022 13:55
My .emacs file
;; This buffer is for text that is not saved, and for Lisp evaluation.
;; To create a file, visit it with <open> and enter text in its buffer.
(add-to-list 'exec-path (expand-file-name "~/.nix-profile/bin"))
(setenv "PATH" (mapconcat 'identity exec-path ":"))
(setenv "NIX_PATH" "nixpkgs=/Users/kjenkins/.nix-defexpr/channels/nixpkgs")
(require 'server)
(unless (server-running-p)
(server-start))
@krisajenkins
krisajenkins / CurrentMarlowe.hs
Created October 2, 2020 15:23
Marlowe Smart Contract
When
[Case
(Deposit
(AccountId
0
(Role "alice")
)
(Role "alice")
(Token "" "")
(Constant 450)
@krisajenkins
krisajenkins / Playground.hs
Created December 12, 2019 12:03
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 Control.Applicative ((<|>))
import Control.Monad (void)
import qualified Data.ByteString.Lazy.Char8 as C
@krisajenkins
krisajenkins / Playground.hs
Created December 6, 2019 12:01
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 Control.Applicative ((<|>))
import Control.Monad (void)
import qualified Data.ByteString.Lazy.Char8 as C
@krisajenkins
krisajenkins / Playground.hs
Created December 6, 2019 11:27
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 Control.Applicative ((<|>))
import Control.Monad (void)
import qualified Data.ByteString.Lazy.Char8 as C
@krisajenkins
krisajenkins / Playground.hs
Created December 4, 2019 16:46
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 Control.Applicative ((<|>))
import Control.Monad (void)
import qualified Data.ByteString.Lazy.Char8 as C
@krisajenkins
krisajenkins / Playground.hs
Last active September 30, 2019 10:30
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 Language.PlutusTx.Prelude
@krisajenkins
krisajenkins / Playground.hs
Created September 17, 2019 09:10
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 Language.PlutusTx.Prelude