Skip to content

Instantly share code, notes, and snippets.


Maximilian Tagher MaxGabriel

View GitHub Profile
MaxGabriel / gist:eacdae1d5948d29f32fd4ed2263d5dd8
Created May 17, 2021
Table of Contents for Alexandrian Remix Fancy Props
View gist:eacdae1d5948d29f32fd4ed2263d5dd8
Kalain's letter to Dalkhar
- page 118
- Four days after Dalakhar’s death, a letter arrives at the Inn of the Dripping Dagger for him.
- The late arrival of the letter is designed to push a clue to PCs after their initial visit: Those who leave their names with the owners of the Dripping Dagger, particularly those who specifically ask the owners to contact them if any new information crops up, will be rewarded with a proactive follow-up. (Alternatively, but probably less likely, it can reward PCs who follow-up on old leads.) Since the clue is non-essential for the current investigation, the slightly heightened risk of them missing the clue is offset by the benefit of adding depth to the game world: Little details like this make the players feel as if the game world is a fully functional, living environment that persists beyond their immediate line of sight. (Largely because that is, in fact, what you’re doing.)
- page 118
- Found in Kalain's Tower
- DOCUMENT LOCKBOX: A document lock
MaxGabriel / DeriveLoadAllModels.hs
Created Nov 22, 2020
Template Haskell to load all Persistent models, stream them from the database, and validate they deserialize correctly
View DeriveLoadAllModels.hs
{-# LANGUAGE AllowAmbiguousTypes #-}
module Mercury.Database.Persist.DeriveLoadAllModels (mkLoadAllModels) where
import ClassyPrelude
import Control.Monad.Logger (MonadLogger, logInfoN)
import Data.Acquire (with)
import Data.Conduit (fuse, runConduit)
import qualified Data.Conduit.Combinators as Conduit
import qualified Data.Kind as K
MaxGabriel / gist:167eadb8548286177ffbea95ca73757d
Created Jun 21, 2020
ghcid bug user error (could not create file system event stream)
View gist:167eadb8548286177ffbea95ca73757d
This file has been truncated, but you can view the full file.
(130) ❄️ ~/D/M/h/mercury-web-backend> ghcid -o ghcid.txt --command 'cabal new-repl lib:mercury-web-backend' --allow-eval --warnings --verbose 20:58:35
%OS: darwin
%ARCH: x86_64
%VERSION: 0.7.6
Loading cabal new-repl lib:mercury-web-backend ...
%STDOUT: Build profile: -w ghc-8.6.5 -O0
%STDOUT2: Build profile: -w ghc-8.6.5 -O0
Build profile: -w ghc-8.6.5 -O0
%STDOUT: In order, the following will be built (use -v for more details):
MaxGabriel / gps-parser.hs
Created May 9, 2020
Degrees minutes seconds parser in haskell, for parsing e.g. 37 deg 8' 21.26" N, 80 deg 34' 41.84" W
View gps-parser.hs
latToDecimal :: DMSLat -> Double
latToDecimal (DMSLat dms direction) =
let decimal = dmsToDecimal
in case direction of
North -> decimal
South -> decimal * -1
lonToDecimal :: DMSLat -> Double
lonToDecimal (DMSLon dms direction) =
let decimal = dmsToDecimal


Long compilation times are a challenge for large Haskell projects. After tricks like giving GHC more memory are exhausted, users have a few levers within their code to speed up compilation:

  1. Reducing the time it takes to compile a module (e.g. removing unnecessary deriving statements, deleting unused code, etc.)
  2. Improving parallelism, which currently is done at the module level.
  3. Improving caching via incremental builds (mostly unrelated to this feature request)

However, users don't have great insight into what modules are slow to compile, and where compilation is bottlenecked on fewer than the available CPU cores, leading to fruitless StackOverflow questions like this one:

View gist:5badd57a3ded7bac2ba43cc3c2a2a3b3
Running 1 benchmarks...
Benchmark persistent-th-bench: RUNNING...
benchmarking mkPersist/From File
time 606.2 μs (578.8 μs .. 631.0 μs)
0.963 R² (0.939 R² .. 0.978 R²)
mean 942.0 μs (820.5 μs .. 1.092 ms)
std dev 529.6 μs (428.2 μs .. 641.2 μs)
variance introduced by outliers: 99% (severely inflated)
View main.dump-splices
test/main.hs:(41,124)-(56,2): Splicing expression
\Person json\n\
\ name Text\n\
\ age Int Maybe\n\
\ foo Foo\n\
\ address Address\n\
\ deriving Show Eq\n\

Testing Plan / How I Tested

  • Wrote a test
  • Tested locally (running SHA)
  • Tested on staging (running SHA)
  • Will test in production


View gist:6bb94023688b05e12ec02ddccae28166
- aeson
- aeson-casing
- aeson-iproute
- aeson-pretty
- aeson-typescript
- amazonka
- amazonka-core
- amazonka-s3
- amazonka-sqs
- async
MaxGabriel / parser.ts
Created Sep 24, 2018
Date parsing code
View parser.ts
import * as P from 'parsimmon'
import Day from '~/utils/Day'
import Month from '~/utils/Month'
const shortMonths = {
jan: 1,
feb: 2,
mar: 3,
apr: 4,
may: 5,