Last active
October 24, 2024 15:16
-
-
Save derrickturk/2d44286cca6f0f1098a95539d8bd2bf9 to your computer and use it in GitHub Desktop.
A dinky "productivity app"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let Block = { level: Natural, list: List Text } | |
let blacklist: List Block = | |
[ { level = 0 | |
, list = | |
[ "reddit.com" | |
, "old.reddit.com" | |
, "www.reddit.com" | |
, "twitter.com" | |
, "x.com" | |
, "nitter.poast.org" | |
, "xcancel.com" | |
] | |
} | |
, { level = 1 | |
, list = | |
[ "linkedin.com" | |
, "news.ycombinator.com" | |
, "lobste.rs" | |
] | |
} | |
, { level = 2 | |
, list = | |
[ "news.google.com" | |
, "theatlantic.com" | |
] | |
} | |
] | |
let List/concat = https://raw.githubusercontent.com/dhall-lang/dhall-lang/v23.0.0/Prelude/List/concat.dhall | |
let List/filterMap = https://raw.githubusercontent.com/dhall-lang/dhall-lang/v23.0.0/Prelude/List/filterMap.dhall | |
let Natural/lessThanEqual = https://raw.githubusercontent.com/dhall-lang/dhall-lang/v23.0.0/Prelude/Natural/lessThanEqual.dhall | |
let Text/concatMap = https://raw.githubusercontent.com/dhall-lang/dhall-lang/v23.0.0/Prelude/Text/concatMap.dhall | |
in λ(level: Natural) → | |
let filtered = List/filterMap Block (List Text) | |
(λ(b: Block) → | |
if Natural/lessThanEqual b.level level | |
then Some b.list | |
else None (List Text)) | |
blacklist | |
let catted = List/concat Text filtered | |
in Text/concatMap Text (λ(url: Text) → "0.0.0.0 ${url}\n") catted |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/env bash | |
sudo sh -c 'echo \# Static table lookup for hostnames. >/etc/hosts' | |
sudo sh -c 'echo \# See hosts\(5\) for details. >>/etc/hosts' | |
dhall text <<<"$(dirname "$0")/blacklist.dhall $1" | sudo tee -a /etc/hosts >/dev/null |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/env bash | |
sudo sh -c 'echo \# Static table lookup for hostnames. >/etc/hosts' | |
sudo sh -c 'echo \# See hosts\(5\) for details. >>/etc/hosts' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment