Skip to content

Instantly share code, notes, and snippets.

View frederik-elwert's full-sized avatar

Frederik Elwert frederik-elwert

View GitHub Profile
function Div(el)
if (el.attributes.lang == "zh") then
return {pandoc.RawBlock("latex", "\\begin{otherlanguage}{chinese}"),
el,
pandoc.RawBlock("latex", "\\end{otherlanguage}")}
end
end
function Span(el)
if (el.attributes.lang == "zh") then
#!/usr/bin/env python3
import sys
import argparse
import logging
import datetime
import csv
from pathlib import Path
from holidays.countries.germany import Germany
@frederik-elwert
frederik-elwert / degender.lua
Created September 19, 2022 11:23
Simple lua filter to replace intra-word colons as a degender symbol with * or a configurable marker (like _)
--- Replace intra-word colons with gender star or gap
--
-- Copyright 2022 Frederik Elwert <frederik.elwert@rub.de>
--
-- LICENSE
--
-- Permission is hereby granted, free of charge, to any person obtaining a copy
-- of this software and associated documentation files (the "Software"), to
-- deal in the Software without restriction, including without limitation the
-- rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
@frederik-elwert
frederik-elwert / add_music.py
Created March 12, 2021 19:51
Script for converting music or audio books into the format and directory structure required by TonUINO
#!/usr/bin/env python3
import sys
import argparse
import logging
import shutil
import subprocess
from pathlib import Path
MAX_DIRS = 99
@frederik-elwert
frederik-elwert / pandoc-merge.py
Created November 27, 2020 10:47
Script that performs mail merge using pandoc, jinja2, and pdftk.
#!/usr/bin/env python3
import sys
import argparse
import logging
import csv
import subprocess
import tempfile
from pathlib import Path
from jinja2 import Template
from pathlib import Path
def sizeof_fmt(num, suffix='B'):
"""Readable file size"""
for unit in ['', 'k', 'M', 'G', 'T', 'P', 'E', 'Z']:
if abs(num) < 1024.0:
return "%3.1f %s%s" % (num, unit, suffix)
num /= 1024.0
return "%.1f%s%s" % (num, 'Yi', suffix)
@frederik-elwert
frederik-elwert / searchingoogle.js
Last active February 11, 2020 14:57
Search in Google Bookmarklet
javascript:q=document.getElementById("search_form_input").value;window.location="https://www.google.de/search?q="+encodeURIComponent(q);
@frederik-elwert
frederik-elwert / md2to3.py
Created September 28, 2019 11:08
Script for converting Python 2 to Python 3 in Markdown files
#!/usr/bin/env python3
import sys
import tempfile
import logging
import re
from pathlib import Path
from lib2to3 import refactor
from lib2to3.pgen2.parse import ParseError
@frederik-elwert
frederik-elwert / Elwert_Open_scholarship.md
Last active August 29, 2015 14:19
Guest post for the OA-OA blog on Open Scholarship in Religious Studies and Theology
title author
Open Data, Open Standards and Open Source. Field notes from the SeNeReKo project
Frederik Elwert

The Center for Religious Studies (CERES) at Ruhr-University Bochum is a great place to study religion, with a variety of scholars from different backgrounds contributing to interdisciplinary research projects. But despite its innovative research, it still inherits much of the conservatism of its constituent disciplines, Religious Studies, Theology, Indology, Islamic and Jewish Studies, and others. When we started with SeNeReKo, a small digital humanities project, in 2012, we got an opportunity to learn many new lessons on open scholarship.

I am glad to have the opportunity to share some of my ideas on this topic here on the OA-OA blog. I will not talk about Open Access, probably the last step in the research cycle, although colleagues of mine at CERES recently started collecting experiences with that as well, launching a small Open

@frederik-elwert
frederik-elwert / pdf2swf.sh
Created January 14, 2015 17:42
SWF export extension for Inkscape
#! /bin/sh
rc=0
pdf2swf -qq -s transparent "$1" -o /tmp/temp.swf
cat < /tmp/temp.swf || rc=1
rm -f /tmp/temp.swf
exit $rc