link to the video
original essay
- Write in past tense so you don’t have to re-edit when mailing
| function llm_replace_commandline | |
| set -l cmdline (commandline) | |
| # Extract everything after '::' (last captured group), and use the name as template | |
| set -l extracted (string match --groups-only -r '.*::(\S+)?\W?(.*)$' -- $cmdline) | |
| # If no match, do nothing | |
| if test -z "$extracted" | |
| notify-send "no :: match" | |
| return |
| module Builder where | |
| import Data.ByteString.Builder qualified as Bytes | |
| import Data.ByteString.Lazy qualified as Bytes.Lazy | |
| import Data.Functor.Contravariant | |
| import Data.String | |
| import Data.Text.Lazy qualified as Text.Lazy | |
| import Data.Text.Lazy.Builder qualified as Text | |
| import Data.Text.Lazy.Builder.Int qualified as Text | |
| import MyPrelude |
| {-# LANGUAGE AllowAmbiguousTypes #-} | |
| {-# LANGUAGE PolyKinds #-} | |
| {-# LANGUAGE TypeFamilies #-} | |
| {-# LANGUAGE UndecidableInstances #-} | |
| module Permissions | |
| ( Permission, | |
| PermissionLabel, | |
| HasPermission, |
| let | |
| pkgs = import <nixpkgs> {}; | |
| lib = pkgs.lib; | |
| allOptions = (import <nixpkgs/nixos> {}).options; | |
| # ** some helpers | |
| # Like mapAttrs, but if `null` is returned from the mapping function, | |
| # the element is removed from the attrset. | |
| # |
| module Abc (jsonWith') where | |
| import Data.Aeson hiding (Value (..)) | |
| import Data.Aeson.Key qualified as Key | |
| import Data.Aeson.KeyMap qualified as KM | |
| import Data.Aeson.Parser.Internal hiding (jsonWith') | |
| import Data.Attoparsec.ByteString qualified as A | |
| import Data.Attoparsec.ByteString.Char8 (Parser, char, string) | |
| import Data.Function (fix) | |
| import Data.Functor (($>)) |
| module Postgres.Decoder where | |
| import Control.Applicative (Alternative) | |
| import Data.Aeson qualified as Json | |
| import Data.Aeson.BetterErrors qualified as Json | |
| import Data.Error.Tree | |
| import Data.Typeable (Typeable) | |
| import Database.PostgreSQL.Simple.FromField qualified as PG | |
| import Database.PostgreSQL.Simple.FromRow qualified as PG | |
| import Json qualified |
link to the video
original essay
| #!/usr/bin/env python3 | |
| # Small wrapper around nix-instantiate and `nix-store --realize` | |
| # that checks whether the output path is already in a cache | |
| # and if it isn’t, builds it. | |
| # | |
| # The arguments you pass will be given to nix-instantiate, | |
| # not to nix-store --realize | |
| # (This might be a TODO for the future). |
| {-# LANGUAGE DataKinds #-} | |
| {-# LANGUAGE DerivingStrategies #-} | |
| {-# LANGUAGE LambdaCase #-} | |
| module Label | |
| ( -- * Labels | |
| Label, | |
| label, | |
| label', | |
| getLabel, |
| -- | Implement this class if you want your type to only implement the part of 'Num' | |
| -- that allows creating them from Integer-literals, then derive Num via 'NumLiteralOnly': | |
| -- | |
| -- @ | |
| -- data Foo = Foo Integer | |
| -- deriving (Num) via (NumLiteralOnly "Foo" Foo) | |
| -- | |
| -- instance IntegerLiteral Foo where | |
| -- integerLiteral i = Foo i | |
| -- @ |