Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:

Marcin Szamotulski coot

:octocat:
View GitHub Profile
@coot
coot / Pipelined.hs
Last active May 4, 2021
Explicit pipelining without concurrency
View Pipelined.hs
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE DerivingStrategies #-}
{-# LANGUAGE DerivingVia #-}
{-# LANGUAGE EmptyCase #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE StandaloneDeriving #-}
@coot
coot / viewport.vim
Last active Nov 20, 2020
View portion of a buffer, mapped through BufWriteCmd file to the original buffer.
View viewport.vim
" Author: Marcin Szamotulski, © 2012-2020
" License: Vim-License, see :help license
fun! ViewPort(cmd, s_line, e_line, ...) " {{{1
if !has("autocmd")
echohl WarningMsg
echom "[ViewPort]: requires +autocmd feature"
echohl Normal
return
endif
@coot
coot / FlipFlops.hs
Last active Sep 27, 2020
Flip-Flops
View FlipFlops.hs
{-# LANGUAGE NamedFieldPuns #-}
-- | https://en.wikipedia.org/wiki/Flip-flop_(electronics)#SR_NOR_latch
module FlipFlops
( -- * Logic primitives
-- * SR-NOR--Latch
SRNORLatch
, mkSRNORLatch
, runSRNORLatch
-- ** SR-NAND--Latch
@coot
coot / dwm.vim
Last active Feb 5, 2020
Simple dwm like window managment for vim
View dwm.vim
" Simple DWM like window managment for vim windows
fun! WinFocus(winnr)
" this assumes that windows have a two column layer: master windows on the
" left, and right column consists of a list of opened windows
if a:winnr == 0
let l:winnr = winnr()
else
let l:winnr = a:winnr
endif
if l:winnr == 1
@coot
coot / Control.Cateogory.Tracer.hs
Last active Aug 6, 2019
Tracer using `Arrow` categories
View Control.Cateogory.Tracer.hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
import Prelude hiding (filter, (.))
import Control.Arrow
import Control.Category
data TracerC c a where
@coot
coot / Naturals.agda
Last active Jun 23, 2019
Natural numbers - simple formal proofs in Agda & Haskell
View Naturals.agda
module Naturals where
-- based on https://plfa.github.io/
import Relation.Binary.PropositionalEquality as Eq
open Eq using (_≡_; refl; cong; sym; trans)
open Eq.≡-Reasoning using (begin_; _≡⟨⟩_; _≡⟨_⟩_; _∎)
data : Set where
zero :
@coot
coot / keybase.md
Created Dec 17, 2018
keybase.io proof
View keybase.md

Keybase proof

I hereby claim:

  • I am coot on github.
  • I am coot (https://keybase.io/coot) on keybase.
  • I have a public key ASA4C4mk10e3x-LowdhnXeF8_qd8-tK_UhiEfw47z8u6zwo

To claim this, I am signing this object:

@coot
coot / Main.purs
Created Nov 16, 2017
Type level cofree react router
View Main.purs
module Type.React.Router where
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (CONSOLE, log)
import Prelude (Unit)
import Type.Proxy (Proxy(..))
import Type.Trout (type (:/), Capture, Lit, Named, QueryParam, QueryParams, Sub)
type PBool = Proxy Boolean
@coot
coot / Main.purs
Last active Sep 23, 2017
Array builder
View Main.purs
module Main where
import Prelude
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Console (logShow)
import Control.Monad.ST (ST, pureST)
import Data.Foreign (Foreign, toForeign)
import Data.StrMap as StrMap
import Data.StrMap.ST as STStrMap
@coot
coot / term.vim
Created Sep 17, 2017
Vim 8.1112 terminal helper
View term.vim
set tk=<C-L>
tmap <c-x> <c-l>:hide<cr>
tmap <c-w><c-x> <c-l>:bd!<cr>
" Find first terminal buffer
fun! TermBufNr()
redi => ls
filter #\v<(zsh|bash)># ls
redi END