Skip to content

Instantly share code, notes, and snippets.

@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
@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 / mdparse.py
Last active June 10, 2022 22:26
Parse Markdown to HTML via Python
# -*- coding: utf-8 -*-
import re
from collections import OrderedDict
from string import Template
BASE_HTML = Template("""<!DOCTYPE html><!-- $TITLE, $TYPE written by $AUTHOR --><head><title>$TITLE</title><meta charset="$ENCODE"/><style>body{font-family:$FONT;}.underlined{text-decoration: underline;}.obfuscated{text-decoration:line-through;}.centered{text-align:center;}table{border-collapse:collapse;}th{border:1px solid black;padding:5px;background-color:#DDDDDD;}td{border:1px solid black;padding:5px;}</style></head><body>$html</body>""")
class Token:
def __init__(self, regex):