Skip to content

Instantly share code, notes, and snippets.

@YoEight
YoEight / improve_fonts.md
Created January 15, 2021 10:11 — forked from j1cs/improve_fonts.md
Improve fonts archlinux

Improve Fonts

Newest

Make your Arch fonts beautiful easily! This is what I do when I install Arch Linux to improve the fonts.

You may consider the following settings to improve your fonts for system-wide usage without installing a patched font library packages (eg. Infinality):

Install some fonts, for example:
sudo pacman -S ttf-dejavu ttf-liberation noto-fonts

@YoEight
YoEight / Dyna.hs
Last active August 2, 2022 19:44
Computes Fibonacci number with a histomorphism -- correction: Actually it's a dynamorphism as it uses an anamorphism to generate intermediary step
data Cofree f a = a :< (f (Cofree f a))
-- Fix point
newtype Mu f = Mu { unMu :: f (Mu f) }
extract :: Cofree f a -> a
extract (a :< _) = a
-- catamorphism
cata :: Functor f => (f b -> b) -> Mu f -> b
@YoEight
YoEight / delete.hs
Created February 16, 2020 10:21
How delete for Map should be.
import Data.Map (Map)
import Data.Map as Map
--------------------------------------------------------------------------------
-- | I'm bad at naming thing however, we are going to use that datastructure
-- so we could lookup and delete in one single pass.
data Blob a b = Blob a b
--------------------------------------------------------------------------------
instance Functor (Blob a) where
@YoEight
YoEight / recursion.hs
Created December 23, 2013 22:57
Recursion scheme playground
{-# LANGUAGE NoImplicitPrelude #-}
module Origami where
import Prelude
(
(.)
, (-)
, (*)
, (++)
, ($)
@YoEight
YoEight / Main.hs
Last active September 27, 2019 06:32
eventstore client showdown
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE NumericUnderscores #-}
module Main where
import Control.Monad
import Database.EventStore
import qualified Data.Text as Text
import Data.Aeson
#!/usr/bin/env stack
-- stack --resolver lts-13.27 script --package text --package turtle --package async
{-# LANGUAGE OverloadedStrings #-}
import Control.Concurrent.Async
import Data.Foldable
import Data.Text (pack)
import Turtle
@YoEight
YoEight / Play.hs
Created April 19, 2019 08:51
Implementing `machines` using `streaming` library
{-# LANGUAGE GADTs #-}
{-# LANGUAGE RankNTypes #-}
module Play where
import Prelude hiding ((.), id)
import Data.Foldable
import Streaming.Internal
import Control.Category
infixr 9 <~
@YoEight
YoEight / docker-cleanup-resources.md
Created August 3, 2018 20:23 — forked from bastman/docker-cleanup-resources.md
docker cleanup guide: containers, images, volumes, networks

Docker - How to cleanup (unused) resources

Once in a while, you may need to cleanup resources (containers, volumes, images, networks) ...

delete volumes

// see: https://github.com/chadoe/docker-cleanup-volumes

$ docker volume rm $(docker volume ls -qf dangling=true)

$ docker volume ls -qf dangling=true | xargs -r docker volume rm

@YoEight
YoEight / extensible.hs
Created April 27, 2018 16:06
POC of eventsource-api using an extensible-effects interface
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE UndecidableInstances #-}
module Main where
@YoEight
YoEight / examples.hs
Created October 10, 2012 09:43
Haskell machine package examples
module Examples where
import Control.Applicative
import Control.Monad.Trans
import Data.Machine
data Bit = EMPTY | One | Zero
instance Show Bit where