Skip to content

Instantly share code, notes, and snippets.

@bertsky
bertsky / ocrd_fix_imagefilename.py
Created June 11, 2024 14:47
DFG METS: overwrite PAGE-XML @imageFilename from image fileGrp
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")
@bertsky
bertsky / plot-cuda-util.sh
Last active September 17, 2024 22:28
Plot GPU compute and memory utilization curve
#!/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=$!