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 / 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 / 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 / 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 / myAsync.hs
Last active November 19, 2021 23:27
waitany haskell aync impl
#!/usr/bin/env stack
{-
stack
--resolver lts-17.13 runghc
--package HTTP
--package http-conduit
-}
--
-- chapter-8, Parallel-concurrent-programming in haskell
@kayvank
kayvank / Perms.scala
Created March 19, 2021 02:47
Permutations on a List
///////////////////////////////////////////////////////////
/// may seem more complicated thatn it realy is for:
/// 1- concat behaves diff in haskell from Scala, so I need to modify it a bit
/// 2- There is no concatMap in Scala Collection API, there is one in Scala Cats, but didnt want to use cats for this assignment
//////////////////////////////////////////////////////////////
/// About the solution:
/// The general notion is to extend the `inserts` function to the entire collection where `inserts` inserts all the way an elelemt may be inserted in a colletion
////////////////////////////////////////////////////////////
object Perms {
@kayvank
kayvank / build.sbt
Created July 9, 2020 00:28
sbt-sample
import Dependencies._
import NativePackagerHelper._
import com.typesafe.sbt.packager.docker._
import com.typesafe.sbt.GitVersioning
import TodoListPlugin._
ThisBuild / resolvers ++= Seq(
"Apache Development Snapshot Repository" at
"https://repository.apache.org/content/repositories/snapshots/",
Resolver.mavenLocal
Map(3a0024001447373333353132 -> List(7.709459459805918, 7.8108108110592775, 7.391891892283194, 7.493243243536553, 5.942708333265634, 6.020833333185698, 5.697916666647324, 5.776041666567388, 5.733668341709829, 5.809045226055691, 5.497487437231127, 5.57286432157699, 7.314102563997921, 7.410256410053105, 7.012820512776264, 7.108974358831447), 2d0048001147373239303438 -> List(9.431034483054937, 5.3965517243001475, 14.025641023871069, 8.025641024617322), 40003b001247373333353132 -> List(4.279617477289208E-6, 1.2015849069376464E-5, 1.5294117648905088, 4.294117647050432, 1.3928571429986714, 3.910714285631921), 3f0032000251363131363432 -> List(4.591603053552664, 4.473282442797697, 4.534351145212424, 4.530534351137937, 3.8557692307306626, 3.756410256318171, 3.807692307703071, 3.804487179345762, 3.3792134831724763, 3.2921348314386285, 3.3370786517542856, 3.334269662856819, 4.105802047841151, 4.0, 4.05460750864328, 4.051194539197871), 4b005b000250483553353520 -> List(4.2526690391853, 4.2526690391853, 4.199288256217254,
@kayvank
kayvank / sudo lspci -nnk
Created April 10, 2020 18:44
thinkpad p1 GPU Nvidia graphic
00:00.0 Host bridge [0600]: Intel Corporation 8th Gen Core Processor Host Bridge/DRAM Registers [8086:3ec4] (rev 0d)
Subsystem: Lenovo Device [17aa:229f]
Kernel driver in use: skl_uncore
00:01.0 PCI bridge [0604]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor PCIe Controller (x16) [8086:1901] (rev 0d)
Kernel driver in use: pcieport
00:02.0 VGA compatible controller [0300]: Intel Corporation UHD Graphics 630 (Mobile) [8086:3e9b] (rev 02)
Subsystem: Lenovo Device [17aa:229f]
Kernel driver in use: i915
Kernel modules: i915
00:04.0 Signal processing controller [1180]: Intel Corporation Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Thermal Subsystem [8086:1903] (rev 0d)
@kayvank
kayvank / journalctl -xe
Last active April 9, 2020 20:59
opensuse-tumbleweed displaylink stopped working with the last opensuse update
laptop: thinkpad p1, Intelxeon, nvidia GPU
➜ uname -r
5.6.0-1-default
cat /etc/os-release
---------------start cut&paste ----------------
NAME="openSUSE Tumbleweed"
# VERSION="20200402"
ID="opensuse-tumbleweed"
module Main where
import Split.LibSplit
main :: IO()
main = do
input <- getLine
let result = ourSplit input
print result
---------------------------