Skip to content

Instantly share code, notes, and snippets.

View chrisdone-artificial's full-sized avatar

Chris Done chrisdone-artificial

View GitHub Profile
#!/usr/bin/env hell
-- Check all the prefixes and permitted delimiters against
-- <https://www.conventionalcommits.org/en/v1.0.0/>
main = do
title <- Environment.getEnv "PR_TITLE"
if List.or $
List.map (\prefix ->
ghci> runReader (runParserT (do a <- local (+1) ask; b <- ask; pure (a,b)) "" "") 0
Right (1,0)
@chrisdone-artificial
chrisdone-artificial / times.el
Created May 13, 2024 13:35
parsing todoist style times in emacs lisp
(rx-define do-rx
(and word-start
(or
;; today/tomorrow
(and (group-n 1 "tom") (optional "orrow"))
(or (and (group-n 1 "tod") (optional "ay")))
;; next <thing>
(and "next "
(group-n 2 (or "week" "month" "year")))
;; in x <duration>
@chrisdone-artificial
chrisdone-artificial / hell-http.hs
Last active June 30, 2024 21:17
hell-http.hs demo
#!/usr/bin/env hell
-- How to run this:
--
-- socat TCP-LISTEN:8081,fork,reuseaddr,max-children=20 EXEC:"./handler.hell"
main = do
line <- Text.getLine
let content =
Text.concat ["<h1>Hello, World!</h1><p>This is generated by Hell.</p><pre>", line, "</pre>"]
(defcustom albero-width 30
"Width of the albero window.")
(defvar albero-expanded (make-hash-table :test 'equal))
(defun albero-win-config-hook ()
(let ((w (albero-window)))
(when w
(albero-adjust-win w))))
bash-3.2$ ghc T.hs && ./T
[1 of 2] Compiling Main             ( T.hs, T.o ) [Source file changed]
[2 of 2] Linking T [Objects changed]
(a) -> (a)
Bool
Bool
Type error
CallStack (from HasCallStack):
 error, called at T.hs:126:16 in main:Main
@chrisdone-artificial
chrisdone-artificial / 0readme.md
Last active December 12, 2023 10:55
Copy tab title + url as rich text bookmarklet

You need to enable dom.events.asyncClipboard.clipboardItem for it to work, via about:config.

(define-derived-mode shoe-mode
fundamental-mode "Shoe"
"Auto-paging shell mode..
\\{shoe-mode-map}"
(linum-mode -1))
(defconst shoe-dir "~/.shoe")
(defvar shoe-shell-program "/bin/bash")
{-# LANGUAGE GADTs #-}
{-# LANGUAGE OverloadedRecordDot #-}
{-# LANGUAGE UndecidableInstances #-}
module Brossa.Authorization where
-- brossa-specific
import qualified Brossa.DB.Rel8 as BrossaRel8
import qualified Brossa.DB.Hasql as BrossaHasql