Skip to content

Instantly share code, notes, and snippets.

View MonoidMusician's full-sized avatar

Verity Scheel MonoidMusician

View GitHub Profile
@MonoidMusician
MonoidMusician / sugar.js
Created January 26, 2024 05:05
Silly little syntax sugars for JavaScript :3
// Silly little syntax sugars :3
// _.name({name:"hello"}) == "hello"
// mk.name("hello") == {name: "hello"}
// _pipe.join(", ").length.line_(["do", "re", "mi"]) == 10
// Create a simple proxy for syntactic sugar for method names and function calls
const sugar = (handler, applier=undefined) => new Proxy(applier ? ()=>{} : {}, {
get: (_target, property, _thisArg) => {
return handler(property);
@MonoidMusician
MonoidMusician / bug.py
Last active August 14, 2023 20:54
Weird bug(?) with fish not responding to SIGKILL
#!/usr/bin/env python3
import subprocess
from time import sleep
import sys
buggy = True
file = "'" + sys.argv[1] + "'"
p = subprocess.Popen(["fish" if buggy else "bash", "-c", "ffplay -nodisp -autoexit -hide_banner -loglevel error " + file])
#!/usr/bin/env python3
import re
import sys
# install this dependency from pip:
from wrapt import ObjectProxy
class FormattableMatch(ObjectProxy):
def __str__(self):
m = self.__wrapped__
module coefin.notarealagdafile where
-- This would be great syntax, but I don't think we can make it all implicit
------------------------------
-- Number/Numeral nonsense: --
------------------------------
-- `Fin` is an implicit coercion
@MonoidMusician
MonoidMusician / sat_turing_machine.py
Last active February 9, 2023 06:58
So uhm, I wrote a sketch of a Turing Machine for SAT
# pseudo-assembly for a turing machine
# tape layout for SAT problem in nvar variables with CNF of length len
# (convenient to assume len >= nvar to make a single measure of complexity)
# we will be deleting clauses as we go, but otherwise the tape stays constant
# nvar variables, 3 bits each
nvar * <notSIGIL=0><mut mark=0><value>
# sigil separating variable table from CNF
<SIGIL=1>
@MonoidMusician
MonoidMusician / solver_performance.json
Created November 30, 2022 07:03
times in milliseconds, negative numbers for package versions that failed to solve
{
"abc-parser@1.1.2":
300,
"abc-parser@1.2.0":
537,
"abc-parser@1.2.1":
513,
"abc-parser@1.3.0":
398,
"abc-parser@1.4.0":
module Metalanguage where
import Prelude
import Data.Array as Array
import Data.Maybe (Maybe(..))
import Data.Traversable (sequence, traverse)
data Value = ScalarValue String | VectorValue (Array Value)
data Sization = NonEmpty | Any
@MonoidMusician
MonoidMusician / Main.purs
Created October 31, 2021 04:59
Validation example
module Main where
import Prelude
import Effect (Effect)
import Effect.Class (class MonadEffect)
import Halogen as H
import Halogen.Aff (awaitBody, runHalogenAff)
import Halogen.HTML as HH
import Halogen.HTML.Properties as HP
{-# LANGUAGE QuantifiedConstraints, MultiParamTypeClasses #-}
module CoercibleFunctor where
import Prelude ()
import Data.Coerce (Coercible, coerce)
class (forall x y. Coercible x y => Coercible (f x) (f y)) => Functor f where
map :: forall a b. (a -> b) -> f a -> f b