Skip to content

Instantly share code, notes, and snippets.


Susan Potter mbbx6spp

View GitHub Profile
mbbx6spp / covidate
Last active Jan 16, 2021
Only shows in UTC because timezones are bullshit and I needed to pick one. Sorry. It is what my servers use.
View covidate
#!/usr/bin/env bash
main() {
local -ri mar_end=1583042400
local -ri today="$(date +"%s")"
local -r dow="$(date -u +"%w")"
local -r time="$(date -u +"%T")"
local -ri secs=86400
local -ri days_since="$(( ((${today} - ${mar_end}) / ${secs}) + 1 ))"
mbbx6spp / Functor.purs
Last active Dec 24, 2020
Fast and loose reasoning as to why Functor and Cofunctor are the same. I have to answer this when coworkers as why Comonads are also Functors and not Cofunctors.
View Functor.purs
-- Informally showing that Cofunctor is essentially the same structure as Functor thus why Comonads are a Functor which is
-- effectively a Cofunctor.
-- In PureScript Functor is defined here:
-- class Functor (f :: Type -> Type) where
-- map :: forall a b. (a -> b) -> f a -> f b
-- Informally: Making a dual of something is basically flipping the arrows. But to make is easier to see, let's flip the
-- arguments of map in Functor definition since that shouldn't change anything, like so:
View arrays.js
const fruits = [ 'apples', 'bananas', 'cantelopes', 'durians', false];
const chunked = _.chunk(fruits, 2); // chunks elements of an arrary
const compacted = _.compact(fruits); // removes falsey values
const filled = _.fill(fruits, 'bananas'); // fill with my favorite fuit
const flattened = _.flatten(chunked); // flatten nested arrays
mbbx6spp / Types.purs
Last active Aug 11, 2020
Accompanying PureScript demonstration of native ADTs for the 'Algebraic Data Types in PureScript':
View Types.purs
module Main (main) where
import Data.Unit (Unit)
import Data.Maybe (Maybe (..))
import Effect (Effect)
import Effect.Console (log)
main :: Effect Unit
main = log "hello world"
mbbx6spp /
Last active Jun 25, 2020
Git tips and tricks for dev group presentation

Git Tips


Git has different levels of configuration that apply to different /”scopes”/:

  • system (almost never needed; not covered here)
  • global (which is /”global for a user”/ scoped)
  • local (which is specific to one local clone)
  • worktree (which only applies to the current worktree; only relevant if you work with worktree s)
  • file (not covered here but you can set a git configuration option, when relevant at the file level, to one file)
mbbx6spp /
Last active May 31, 2020
Encrypted ZFS for NixOS

Encrypted ZFS for NixOS


We will have add one partition to a zpool.

You have the following set to appropriate values:

  • disk: the path for your disk device, e.g. /dev/sdb or /dev/nvme0
  • efi: the path for the EFI boot partition’s device, e.g. /dev/sdb1
  • part: the path to the partition of your root filesystem, e.g. /dev/sdb2
mbbx6spp /
Last active May 27, 2020
An M-word work rant of work Slack February 2020 edition.

Below is an excerpt from a Slack work rant from Feburary 4, 2020.

Over the last few weeks I have learned about some of the new additions to both ECMAScript 2019 and 2020 (for reasons!!!!) anyway, the following are relevant to an FP setting: flatMap flattens nested list structure then maps over the elements. Usage:

> let arr1 = ["Australia is", "on", "fire still"];
mbbx6spp / Main.purs
Last active May 4, 2020
Fun with the state transformer with a coworker showing them functional programming constructs. Notice there are more lines of imports than there are lines of code.
View Main.purs
module Main (main) where
import Control.Applicative (pure)
import Control.Bind (bind, discard)
import Control.Monad (void)
import Control.Monad.State (StateT, get, runStateT)
import Data.Array (range)
import Data.Eq ((==))
import Data.Function (($))
import Data.Functor (map)
mbbx6spp / Models.Swagger.purs
Last active Mar 12, 2020
Outline of describing schema with algebraic data types for basic descriptions of data, in this case a Swagger "schema". Eventually we can evolve it in class to generating YAML/JSON Swagger from this data description and possible build swagger representations from Generic Reps
View Models.Swagger.purs
module Models.Swagger where
import Data.Map (Map)
import Data.Maybe (Maybe (..))
import Data.String.Regex (Regex)
import Data.Show (class Show, show)
data SwaggerFormatString
= DateFormat
| DateTimeFormat
mbbx6spp / CatTheory.UniversalConstructions.purs
Last active Jan 16, 2020
Having fun with universal constructions for And and Or types and the correspondance of pairs (fanout, bimap) and (either, fanin) for each.
View CatTheory.UniversalConstructions.purs
-- Module to demonstrate simple applications of the concept of universal construtions
module CatTheory.UniversalConstructions
-- * Types
( And (..)
, Or (..)
-- * Introducers
, and
, left
, right
, fanin