Skip to content

Instantly share code, notes, and snippets.

matze /
Created Feb 17, 2021
Script to rewrite YAML frontmatter to TOML
#!/usr/bin/env python3
import argparse
import re
from pathlib import Path
from typing import List
from enum import Enum
def to_dir_path(arg: str) -> Path:
matze /
Created Sep 4, 2017
Comparison of search algorithms
import os
import sys
import re
import difflib
store = os.path.abspath('/home/matthias/dev/password-store/')
def get_password_names_old(name):
names = []
matze / Makefile
Created Dec 15, 2014
Kobo Hyphenation
View Makefile
all: KoboRoot.tgz
@mkdir -p $(DICT_DIR)
@cp -P /usr/share/hyphen/*.dic $(DICT_DIR)
@find $(DICT_DIR) -type l -exec rm -f {} \;
@tar czf $@ usr/
View trace.json
{"traceEvents": [{"name": "foo", "tid": 140094068987648, "ph": "B", "pid": 11403, "ts": 463.9625549316406, "cat": "f"}, {"name": "foo", "tid": 140094060594944, "ph": "B", "pid": 11403, "ts": 24585.962295532227, "cat": "f"}, {"name": "foo", "tid": 140093981456128, "ph": "B", "pid": 11403, "ts": 32024.860382080078, "cat": "f"}, {"name": "foo", "tid": 140093973063424, "ph": "B", "pid": 11403, "ts": 45877.933502197266, "cat": "f"}, {"name": "foo", "tid": 140093964670720, "ph": "B", "pid": 11403, "ts": 70307.01637268066, "cat": "f"}, {"name": "foo", "tid": 140093956278016, "ph": "B", "pid": 11403, "ts": 84609.9853515625, "cat": "f"}, {"name": "foo", "tid": 140093947885312, "ph": "B", "pid": 11403, "ts": 93953.84788513184, "cat": "f"}, {"name": "foo", "tid": 140093964670720, "ph": "E", "pid": 11403, "ts": 94250.91743469238, "cat": "f"}, {"name": "foo", "tid": 140093964670720, "ph": "B", "pid": 11403, "ts": 99001.88446044922, "cat": "f"}, {"name": "foo", "tid": 140093939492608, "ph": "B", "pid": 11403, "ts": 111577.
matze / Makefile
Last active Aug 29, 2015
HDF5 performance
View Makefile
SRC = perf.c
BIN = perf
PKG_DEPS = glib-2.0
LDFLAGS = -lhdf5
matze / gist:c8c509f836732427e78c
Last active Aug 29, 2015
Support flat files and hdf5
View gist:c8c509f836732427e78c
import os
import h5py
import numpy as np
def touch(fname, data):
f = open(fname, 'w')

Keybase proof

I hereby claim:

  • I am matze on github.
  • I am matze ( on keybase.
  • I have a public key whose fingerprint is DD89 68B2 F64F 0260 A387 5EE0 018A 1479 4D3A 8106

To claim this, I am signing this object:

matze / gist:8971104
Created Feb 13, 2014
Comment spam template – something went wrong with this bot
View gist:8971104
{I have|I've} been {surfing|browsing} online more than {three|3|2|4}
hours today, yet I never found any interesting article like yours.
{It's|It is} pretty worth enough for me. {In my opinion|Personally|In my view},
if all {webmasters|site owners|website owners|web owners} and bloggers made good content as you did, the {internet|net|web} will be {much more|a lot
more} useful than ever before.|
View gist:8860802
class State(object):
def __init__(self, default=None):
self.default = default
def __get__(self, instance, owner):
return self._value(instance)
def _value(self, instance):
if not hasattr(instance, '_state_value'):
setattr(instance, '_state_value', self.default)
View gist:7672662
import time
import gevent
import functools
class GreenletRunner(gevent.Greenlet):
def __init__(self, func, args, kwargs):
super(GreenletRunner, self).__init__()
self.func = func