Skip to content

Instantly share code, notes, and snippets.

View kayvank's full-sized avatar
🏠
@127.0.0.1

Kayvan ≅ کیوان kayvank

🏠
@127.0.0.1
View GitHub Profile
@kayvank
kayvank / channel.hs
Created November 19, 2021 19:42
haskell MVAr channel and multicast channel impl
#!/usr/bin/env stack
{-
stack
--resolver lts-17.13 runghc
-}
--
-- chapter-7, Parallel-concurrent-programming in haskell
-- chmod 755 ./channel.hs && ./channel.hs
--
{-# LANGUAGE OverloadedStrings #-}
@kayvank
kayvank / cancellation.hs
Created November 19, 2021 20:37
haskell cancel-able async impl
#!/usr/bin/env stack
{-
stack
--resolver lts-17.13 runghc
--package HTTP
--package http-conduit
-}
--
-- chapter-9, Parallel-concurrent-programming in haskell
-- chmod 755 ./cancellation.hs && ./cancellation.hs
@kayvank
kayvank / unboundedChannel.hs
Created November 19, 2021 21:45
haskell Asynchronous Exception Safety for Channels
#!/usr/bin/env stack
{-
stack
--resolver lts-17.13 runghc
-}
--
-- chapter-9, Parallel-concurrent-programming in haskell
-- chmod 755 ./unboundedChannel.hs && ./unboundedChannel.hs
--
@kayvank
kayvank / stmAsync.hs
Created November 22, 2021 00:14
haskell aysnc implementation using stm
#!/usr/bin/env stack
{-
stack
--resolver lts-17.13 runghc
--package HTTP
--package http-conduit
-}
--
-- chapter-10, Parallel-concurrent-programming in haskell
@kayvank
kayvank / symetricConcurrency.hs
Created November 22, 2021 15:10
Example of Symmetric Concurrency Combinators from Parallel concurrent programming in Haskell
#!/usr/bin/env stack
{-
stack
--resolver lts-17.13 runghc
--package http-conduit
--package async
-}
--
--
@kayvank
kayvank / nixos 22.05 emacs 27.02
Created December 13, 2021 20:20
getenv PATH does not reflect nix-shell $PATH
Here is my workflow:
$ nix-shell
$ emacs&
from emacs 27.02 (getenv "PATH")
/run/wrapper/bin:/home/kayvan/.nix-profile/bin:/etc/profiles/per-user/kayvan/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
-------------------------- from zsh echo $PATH ---------
echo $PATH
docker system prune --volumes
docker system prune --all
_/build-dars
dc up -d --build
find . -name "*.dar"
#### output of the find command: ###
➜ eleox git:(js-kayvan-EID-17-packageId) ✗ find . -name "*.dar"
./daml/.daml/dist/eleox-do-not-use-0.0.1.dar
./daml/.packages/eleox-triggers/.daml/dist/eleox-triggers-0.0.1.dar
./daml/.packages/eleox/.daml/dist/eleox-0.0.1.dar
@kayvank
kayvank / concurrnetSqlite.hs
Last active November 15, 2022 14:52
concurrent sqlite
#!/usr/bin/env stack
{- stack
script
--resolver lts-18.28
--package sqlite-simple
--package async
--package text
-}
{-
-- | the purpose of this code is :
@kayvank
kayvank / defaultParams.sh
Last active October 27, 2022 12:48
node-cli query
## first node must sync:
#####################################
$ cardano-cli query tip --mainnet
{
"block": 7937358,
"epoch": 371,
"era": "Babbage",
"hash": "f580eb4778f57fc5dbbd138ebcb89341239447a9438b13dc2eaccf5bb1c34e17",
"slot": 75306292,
"syncProgress": "100.00"
@kayvank
kayvank / streamSqlite.hs
Last active October 27, 2022 12:47
streamSqlite.hs
#!/usr/bin/env stack
{- stack
script
--resolver lts-18.28
--package sqlite-simple
--package async
--package text
-}
{-
-- | the purpose of this code is to make sure sqlite maybe accessed concurrently