Skip to content

Instantly share code, notes, and snippets.

View frederik-elwert's full-sized avatar

Frederik Elwert frederik-elwert

View GitHub Profile
@frederik-elwert
frederik-elwert / get_datcat.py
Created July 31, 2013 09:49
Get ISOcat closed DC with all referenced simple DCs
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import argparse
import logging
from urllib.parse import urlencode
from urllib.request import urlopen, Request
from lxml import etree
@frederik-elwert
frederik-elwert / HeForShe.R
Last active August 29, 2015 14:07
HeForShe campaign analysis
library(reshape2)
library(plyr)
library(dplyr)
library(RCurl)
library(RJSONIO)
library(stringr)
library(pander)
library(RColorBrewer)
library(rMaps)
@frederik-elwert
frederik-elwert / tei2tcf.py
Created December 18, 2014 18:03
TEI to TCF conversion using TCFlib
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os
import re
from glob import glob
import logging
from lxml import etree
@frederik-elwert
frederik-elwert / Flat to Hierarchy.ipynb
Created January 2, 2015 20:54
Flat to hierarchical XML
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@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
@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 / 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 / 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);
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 / 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