Skip to content

Instantly share code, notes, and snippets.

View langston-barrett's full-sized avatar

Langston Barrett langston-barrett

View GitHub Profile
@Porges
Porges / bash.sh
Last active April 2, 2023 15:31
Uniquely identified words of the form i18n, l10n (ignoring but preserving case, skipping words with apostrophes, using wamerican wordlist)
# to look up a word by "definition" (f2d = find):
f2d() { grep -ixe "$(echo "$1" | sed 's/[[:digit:]]\+/\\w\\{\0\\}/g')" /usr/share/dict/words; }
# to generate the word lists below:
while read word; do if [[ "${#word}" -gt 2 && "$word" != *"'"* ]]; then echo "$word ${word: 0:1} $((${#word} - 2)) ${word: -1:1}"; fi; done < /usr/share/dict/words | sort -f -k2,2 -k3,3n -k4,4 | uniq -u -i -f1 | awk '{ print $2 $3 $4 " " $1 }' > AnZ.txt
# this is mostly getting the output to come out nice:
#
# skip all words less than 3 characters long, or that have apostrophes
# print out like "word w 2 d"
@parsonsmatt
parsonsmatt / prismatic.hs
Created June 5, 2018 20:49
I figured out a nice way to pluck exceptions out of a constraint!
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeApplications #-}
{-# LANGUAGE TypeFamilies #-}
@martijnvermaat
martijnvermaat / nixos.md
Last active May 9, 2024 01:11
Installation of NixOS with encrypted root
@nkpart
nkpart / Err.hs
Last active August 20, 2022 01:20
Lens, Prisms, and Errors.
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE TemplateHaskell #-}
{-# OPTIONS_GHC -fwarn-missing-methods #-}
module Err where
import Control.Lens
import Control.Monad.Error
import Control.Monad.Error.Lens
-- Here is a fairly typical situation, where we have low level errors in certain