Skip to content

Instantly share code, notes, and snippets.

View matze's full-sized avatar

Matthias Vogelgesang matze

View GitHub Profile
@matze
matze / jekyll-to-zola.py
Created February 17, 2021 22:01
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
matze / pass.py
Created September 4, 2017 13:46
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
matze / Makefile
Created December 15, 2014 10:50
Kobo Hyphenation
DICT_DIR=usr/local/Kobo/hyphenDicts
all: KoboRoot.tgz
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/
{"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
matze / Makefile
Last active August 29, 2015 14:01
HDF5 performance
SRC = perf.c
BIN = perf
PKG_DEPS = glib-2.0
LDFLAGS = -lhdf5
include c.mk
@matze
matze / gist:c8c509f836732427e78c
Last active August 29, 2015 14:01
Support flat files and hdf5
import os
import h5py
import numpy as np
def touch(fname, data):
f = open(fname, 'w')
f.close()
@matze
matze / keybase.md
Created April 10, 2014 06:52
keybase.md

Keybase proof

I hereby claim:

  • I am matze on github.
  • I am matze (https://keybase.io/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
matze / gist:8971104
Created February 13, 2014 07:14
Comment spam template – something went wrong with this bot
{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.|
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)
@matze
matze / gist:7672662
Created November 27, 2013 08:54
@async based on gevent
import time
import gevent
import functools
class GreenletRunner(gevent.Greenlet):
def __init__(self, func, args, kwargs):
super(GreenletRunner, self).__init__()
self.func = func