Skip to content

Instantly share code, notes, and snippets.

@pgmmpk
pgmmpk / gist:70a5965c3685166671294dd27b584623
Last active June 24, 2020 01:16
forever loop with iterator factory
def forever(factory, *av, **kav):
yield from factory(*av, **kav)
..
for item in forever(read_blocked_dataset, ds, partition, compression='gzip'):
print(item) # this repeats forever
@pgmmpk
pgmmpk / odt2md.py
Last active May 21, 2019 01:13
odt to markdown conversion script (draft)
'''
Converts ODT (LibreOffice) file to cu-MD
python3 -m venv .venv
. .venv/bin/activate
pip install -U fire lxml lxmlx
python -m odt2md -h
'''
import zipfile
'''
Demostrates what seem to be a performance bug (or puzzle) in PyTorch:
conv2d operation on trained weights is 20-50x slower than using random weights
'''
import contextlib
import torch
from torch import nn
import time