Skip to content

Instantly share code, notes, and snippets.

View deemp's full-sized avatar

Danila Danko deemp

View GitHub Profile
import os {input}
import arrays {sum}
import math {min}
// custom IO
fn read_strings() ([]string) {return os.input('').split(' ')}
fn read_longs() ([]i64) {return read_strings().map(it.i64())}
fn read_ints() ([]int) {return read_strings().map(it.int())}
fn read_floats() ([]f64) {return read_strings().map(it.f64())}
#!/bin/bash
TARGET=~/Downloads/Remote/
inotifywait -m -e create -e moved_to -e modify --format "%f" $TARGET \
| while read FILENAME
do
echo Detected $FILENAME, copying to clipboard
# https://askubuntu.com/a/759660
xclip -selection clipboard -t image/png -i "${TARGET}${FILENAME}"
@deemp
deemp / Main.hs
Last active April 11, 2022 16:52
Infinite recursion due to implementation of Functor via monadic bind
module Main where
import Data.Char (ord, toLower)
newtype PrsE a = PrsE { runPrsE :: String -> Either String (a, String) }
satisfyE :: (Char -> Bool) -> PrsE Char
satisfyE f = PrsE g
where
g "" = Left "unexpected end of input"
g (c:cs)
data Position = Position
{ row :: Int,
column :: Int
} deriving (Data)
data Segment = Segment {start::Position, end::Position} deriving (Data)
data Node a b = Node {pos::Segment, node::a, load::b} deriving (Data)
type I a = Node a ()
newtype PLicense = PLicense {cs::[I PComment]} deriving (Data)
newtype PComment = PComment {c::Text} deriving (Data)