- append
?print-pdf
to preview URL (in slide mode): https://hackmd.io/@bertsky/SkQGVzlUt?print-pdf - open in Chrome/Chromium and print to PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
fname=$1 | |
# if the log file does not exist yet, record it (stop by pressing ctrl+c) | |
if ! test -f $fname; then | |
nvidia-smi -f $fname -l 1 --format=csv --query-gpu=timestamp,memory.total,memory.used,utilization.gpu,utilization.memory & | |
bg=$! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import click | |
from ocrd_utils import MIMETYPE_PAGE | |
from ocrd_models.ocrd_mets import OcrdMets | |
from ocrd_models.ocrd_page import to_xml | |
from ocrd_modelfactory import page_from_file | |
@click.command() | |
@click.option('-m', '--mets-file', default="mets.xml", help="path to METS of workspace") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
nontext_opts=( | |
xmlstarlet ed -N tei=http://www.tei-c.org/ns/1.0 | |
-d //tei:note | |
-d //tei:fw | |
-d //tei:table | |
-d //tei:figure | |
-d //tei:formula | |
-d //tei:titlePage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import argparse | |
import os | |
import sys | |
import io | |
from functools import reduce | |
import json | |
import unicodedata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Dump user metadata of a kraken model file or fix it. | |
import click | |
import json | |
import os | |
if not 'TF_CPP_MIN_LOG_LEVEL' in os.environ: | |
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
from lxml import etree as ET | |
from ocrd_models.constants import NAMESPACES | |
NAMESPACES['oai'] = "http://www.openarchives.org/OAI/2.0/" | |
for curie in NAMESPACES: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set -e | |
# select first CUDA device (in case there are multiple, which may fail due to [a recent Tensorflow problem](https://github.com/qurator-spk/eynollah/issues/99)) | |
export CUDA_VISIBLE_DEVICES=0 | |
# check we are not running into [this bug](https://github.com/shapely/shapely/issues/1598) | |
python3 -c "from shapely.geometry import Polygon; import torch; torch.randn(10).cuda()" | |
# validate CUDA support is working in TF and Torch (not an exhaustive test) | |
python3 -c "import torch; print(torch.cuda.is_available())" |
- append
?print-pdf
to preview URL (in slide mode): https://hackmd.io/@bertsky/SkQGVzlUt?print-pdf - open in Chrome/Chromium and print to PDF
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import re | |
import click | |
import json | |
from time import time | |
import flask | |
from distutils.spawn import find_executable as which | |
import ocrd |
NewerOlder