Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@felko
felko / TreeModule.scala
Created June 4, 2022 11:16
Trees that grow in Scala 3 using match types
package amyc.ast
import amyc.utils.Positioned
/* A polymorphic module containing definitions of Amy trees.
*
* This trait represents either nominal trees (where names have not been resolved)
* or symbolic trees (where names/qualified names) have been resolved to unique identifiers.
* This is done by having two type fields within the module,
* which will be instantiated differently by the two different modules.
@felko
felko / migrate.py
Last active May 2, 2020 22:09
Migrate your zettelkasten to the new link format
#!/usr/bin/env python3.8
import os
import sys
import re
import glob
ZK, = sys.argv[1:]
def make_link_regex(url_regex):
@felko
felko / migrate.py
Last active May 2, 2020 20:41
Migrate neuron zettelkastens to the new hash ID format
#!/usr/bin/env python3.8
import re
import sys
import os
import uuid
from pathlib import Path
import glob
import time
import datetime
@felko
felko / config.el
Last active August 23, 2020 16:08
doom-emacs configuration for neuron-mode
;;; tools/neuron/config.el -*- lexical-binding: t; -*-
(defface neuron-stub-face
'((((class color) (min-colors 88) (background dark)) :foreground "#C16069" :underline "#C16069")
(((class color) (min-colors 88) (background light)) :foreground "#C16069" :underline "#C16069")
(((class color) :foreground "Red" :underline "Red"))
(t :inherit neuron-title-overlay-face))
"Face for stub links."
:group 'neuron-faces)
@felko
felko / Main.hs
Last active May 27, 2020 00:49
linear lambda calculus typechecker
{-# LANGUAGE
LambdaCase
, OverloadedLists
, OverloadedStrings
, RecordWildCards
, BlockArguments
, DeriveFunctor
, TypeApplications
, GeneralizedNewtypeDeriving
#-}
@felko
felko / adt.py
Last active April 1, 2020 18:26
#!/usr/bin/env python3.7
# coding: utf-8
import types
import functools
import abc
import typing
from contextlib import contextmanager
from collections import OrderedDict
@felko
felko / typecheck.jl
Last active September 2, 2019 23:56
# Types
abstract type Type
end
struct VarType <: Type
name :: String
rigid :: Bool
end
#!/usr/bin/env python3.5
# coding: utf-8
from abc import *
from collections import ChainMap, OrderedDict
import re
from operator import eq
#!/usr/bin/env python3.4
# coding: utf-8
from collections import ChainMap
class Bytecode:
def __init__(self, instructions):
self.instructions = instructions
def __str__(self):
#!/usr/bin/env python3
# coding: utf-8
import re
from collections import namedtuple
from functools import wraps
class ParseError(Exception):
pass