Skip to content

Instantly share code, notes, and snippets.

View gregnwosu's full-sized avatar

Gregory Nwosu gregnwosu

View GitHub Profile
@gregnwosu
gregnwosu / ModifiedVesting.hs
Created July 25, 2021 18:45
Trying to calculate the total spend for each input pubkeyhash on a Cardaon contract
-- Vesting scheme as a PLC contract
import Control.Monad (void, when)
import qualified Data.Map as Map
import qualified Data.Text as T
import Ledger (Address, POSIXTime, POSIXTimeRange, PubKeyHash, Validator, txOutPubKey)
import qualified Ledger
import qualified Ledger.Ada as Ada
import Ledger.Constraints (TxConstraints, mustBeSignedBy, mustPayToTheScript, mustValidateIn)
import Ledger.Contexts (ScriptContext (..), TxInfo (..))

Keybase proof

I hereby claim:

  • I am gregnwosu on github.
  • I am gregnwosu (https://keybase.io/gregnwosu) on keybase.
  • I have a public key ASBpHGU_4HSF338RYbOQM2XQoMWmL6wvVARNGAoQXA9_wgo

To claim this, I am signing this object:

@gregnwosu
gregnwosu / HListExample.scala
Created February 20, 2019 13:54
Hlist derivation
sealed trait HList
final case class ::[H, T <: HList](
head: H,
tail: T
) extends HList
sealed trait HNil extends HList
case object HNil extends HNil
object Go {
val hlist = 10 :: "hello" :: true :: HNil
@gregnwosu
gregnwosu / gist:72d0ca95b908b799462b062043dc3a26
Created September 5, 2018 09:54
eta gradle info stacktrace
└─[1] ./gradlew run --info --stacktrace
Initialized native services in: /Users/greg/.gradle/native
The client will now receive all logging from the daemon (pid: 13700). The daemon log file: /Users/greg/.gradle/daemon/4.9/daemon-13700.out.log
Starting 38th build in daemon [uptime: 1 hrs 50 mins 59.855 secs, performance: 100%, no major garbage collections]
Using 8 worker leases.
Starting Build
Settings evaluated using settings file '/Users/greg/dev/eta/eta-init/settings.gradle'.
Projects loaded. Root project using build file '/Users/greg/dev/eta/eta-init/build.gradle'.
Included projects: [root project 'eta-init']
FAILURE: Build failed with an exception.
* What went wrong:
Problem configuring task :run from command line.
> Unknown command-line option '--init'.
* Try:
Run gradlew help --task :run to get task usage details. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Exception is:
@gregnwosu
gregnwosu / main.hs
Created November 1, 2016 20:45
sequence slower to index?
module SequenceTest where
import Criterion.Main
import qualified Data.Sequence as SQ
s :: SQ.Seq Int
s = SQ.fromList [1..9100]
lists :: [[Int]]
lists = replicate 10 [1..1000000]
seqs :: [SQ.Seq Int]

Keybase proof

I hereby claim:

  • I am gregnwosu on github.
  • I am gregnwosu (https://keybase.io/gregnwosu) on keybase.
  • I have a public key whose fingerprint is 7E82 0848 D961 8907 487D 48B2 884D C0AF C389 330B

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am gregnwosu on github.
* I am gregnwosu (https://keybase.io/gregnwosu) on keybase.
* I have a public key whose fingerprint is 7E82 0848 D961 8907 487D 48B2 884D C0AF C389 330B
To claim this, I am signing this object:
@gregnwosu
gregnwosu / ChapterExercises.hs
Last active July 20, 2016 14:33
why doesnt my traversable pass its tests
module ChapterExercises where
import Data.Monoid ((<>))
data List a =
Nil | Cons a (List a) deriving (Eq, Show, Ord)
instance Functor List where
fmap _ Nil = Nil
fmap f (Cons a l) = Cons (f a) (f<$>l)
@gregnwosu
gregnwosu / System Design.md
Created April 20, 2016 09:14 — forked from vasanthk/System Design.md
System Design Cheatsheet

#System Design Cheatsheet

Picking the right architecture = Picking the right battles + Managing trade-offs

##Basic Steps

  1. Clarify and agree on the scope of the system
  • User cases (description of sequences of events that, taken together, lead to a system doing something useful)
    • Who is going to use it?
    • How are they going to use it?