Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
# coding: utf-8
import re
from collections import namedtuple
from functools import wraps
class ParseError(Exception):
pass
#!/usr/bin/env python3.4
# coding: utf-8
from collections import ChainMap
class Bytecode:
def __init__(self, instructions):
self.instructions = instructions
def __str__(self):
@felko
felko / fibonacci.bf
Last active June 28, 2016 16:14
Loads in memory the fibonacci suite (but doesn't display it)
FIBONACCI SEQUENCE
You have to use an IDE or website in order to visualize the memory
+++++++> The number of numbers to load
+>+> Setup the two first numbers
<[<]>[
[>] Move to the right most ptr
<< [->>+>+<<<] Store the first number in the 2 next free ptr
>>>[<<<+>>>-] Shift the last value in the first number ptr
#!/usr/bin/env python3.5
# coding: utf-8
from abc import *
from collections import ChainMap, OrderedDict
import re
from operator import eq
@felko
felko / terrain_generator.py
Last active October 27, 2016 20:21
Generates a 2D map - randomly generated terrain
# -*- coding: utf-8 -*-
import random
HEIGHT = 32
BLOCK, VOID = True, False
class Block:
blocks = []
@felko
felko / typecheck.jl
Last active September 2, 2019 23:56
# Types
abstract type Type
end
struct VarType <: Type
name :: String
rigid :: Bool
end
@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 / 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 / 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 / Main.hs
Last active May 27, 2020 00:49
linear lambda calculus typechecker
{-# LANGUAGE
LambdaCase
, OverloadedLists
, OverloadedStrings
, RecordWildCards
, BlockArguments
, DeriveFunctor
, TypeApplications
, GeneralizedNewtypeDeriving
#-}