Skip to content

Instantly share code, notes, and snippets.

View tohuuuuu's full-sized avatar

tohuuuuu tohuuuuu

  • Karlsruhe, Germany
View GitHub Profile
@tohuuuuu
tohuuuuu / pocket2html.py
Created May 26, 2025 15:52
Convert Pocket CSV Data Export to HTML
#!/usr/bin/env python3
import re
import pandas
from airium import Airium
dataframe = pandas.read_csv("part_000000.csv", delimiter=",")
dataset = dataframe.values
a = Airium()
@tohuuuuu
tohuuuuu / regex_bverfge.py
Last active July 22, 2024 13:10
Regex zur Extraktion von BVerfGE-Zitaten aus Entscheidungstexten.
"""
We need the Pypi regex module instead of the builtin "re", since the builtin implementation
doesn't allow Lookbehinds with flexible width which we need here.
See https://stackoverflow.com/q/20089922/342546 and https://stackoverflow.com/q/78772454/342546
"""
import regex as re
"""
Regex für BVerfGE-Zitate (nur Band/Startseite, nicht auch zitierte Seite). Basismuster
sind zwei Zifferngruppen, die durch ein Komma getrennt sind.
@tohuuuuu
tohuuuuu / ocrmypdf_rename.sh
Last active March 8, 2024 19:46
OCRmyPDF Loop over pdf files in current dir and append _ocr to resulting pdfs (Language: German)
for i in *.pdf
do
ocrmypdf -l deu -i "$i" "${i/%.pdf/_ocr.pdf}"
done
@tohuuuuu
tohuuuuu / ssh-tunnel.sh
Created May 17, 2020 07:17
OpenSSH Tunnel (bash)
ssh -f <user>@<host> -L <localport>:<remoteserver>:443 -N
@tohuuuuu
tohuuuuu / ssh-tunnel.ps1
Created May 17, 2020 07:16
Powershell command to create a SSH tunnel
start-process -NoNewWindow powershell `
{ssh -f <user>@<host> `
-L 10443:127.0.0.1:443 `
-N }
@tohuuuuu
tohuuuuu / sign_jars.sh
Last active December 3, 2019 12:18
Sign multiple jars using keystore / key passwords from env variables
export storepass="mystorepassword"
export keypass="mykeypassword"
for i in ./*.jar; do jarsigner -storepass:env storepass -keypass:env keypass "$i" key_alias;done
@tohuuuuu
tohuuuuu / transform_xml_to_nfo.sh
Last active February 29, 2024 17:06
run saxon
java -cp /usr/share/java/saxonb.jar net.sf.saxon.Transform -ext:on videodata.xml transform_vsmeta.xslt
@tohuuuuu
tohuuuuu / transform_vsmeta.xslt
Last active February 29, 2024 17:04
XSLT Stylesheet to create single nfo files from VideoStation metadata exported to XML
<xsl:stylesheet
version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<!-- Sets the root directory for the output -->
<xsl:variable
name="outpathprefix"
select="'/tmp/videodata-nfo-out'" />
<xsl:template match="/videodata_tmp/row">
@tohuuuuu
tohuuuuu / export_vsmeta_to_xml.sql
Last active February 29, 2024 17:06
Export result of SQL Query to XML - Synology VideoStation metadata
CREATE TEMP TABLE "videodata_tmp" AS
SELECT
v.mapper_id as id,
'home'||v.mapper_id as uniqueid,
right(v.path, position('/' in reverse(v.path)) - 1) as filename,
v.path,
g2.genre,
h.title,
h.record_time,
s.summary