Skip to content

Instantly share code, notes, and snippets.

Lucas Werkmeister lucaswerkmeister

Block or report user

Report or block lucaswerkmeister

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
lucaswerkmeister / category-download
Created Aug 19, 2019
script to download all files in a Wikimedia Commons category
View category-download
declare -A original_params=(
[gcmtitle]="Category:${1:?category not specified}"
lucaswerkmeister / import.js
Created Apr 12, 2019
Client-side (in-browser) import of Wikidata entities into another Wikibase installation
View import.js
async function importEntitiesFromWikidata( wikidataEntityIds ) {
const params = new URLSearchParams();
params.set( 'action', 'wbgetentities' );
params.set( 'ids', wikidataEntityIds.join( '|' ) );
params.set( 'props', [ 'labels', 'descriptions', 'aliases', 'datatype' ].join( '|' ) );
params.set( 'format', 'json' );
params.set( 'origin', '*' );
const response = await fetch( `${ params.toString() }` ),
json = await response.json();
for ( const wikidataEntityData of Object.values( json.entities ) ) {
lucaswerkmeister / wipe-ssh-agent.service
Created Mar 19, 2019
systemd user units to wipe sensitive SSH keys from the SSH agent every night
View wipe-ssh-agent.service
Description=Wipe sensitive SSH keys from the SSH agent
ExecStart=/usr/bin/ssh-add -d ${HOME}/.ssh/KEY-NAME-1 ${HOME}/.ssh/KEY-NAME-2 …
# don’t fail if the key wasn’t in the SSH agent in the first place
lucaswerkmeister / increment.sed
Created Feb 18, 2019
sed script to increment an integer by one
View increment.sed
#!/bin/sed -f
# if the number is not negative:
/^-/! {
# increment the last digit; mark carry with an “X”
lucaswerkmeister /
Created Nov 25, 2018
Wikidata For Long-Time Wikipedians elevator pitch, written at the Wikidata Train the Trainers workshop in Berlin

Elevator Pitch: Wikidata für langjährige Wikipedianer_innen

Du arbeitest bei Wikipedia mit, oder? Okay, stell dir vor:

Im südostasiatischen Hinterhuglhapfing wurde eine neue Volkszählung durchgeführt. Artikel in der bairischen Wikipedia für alle Orte in der Region wurden schon vor Jahren angelegt – wer aktualisiert jetzt die Einwohnerzahlen?

Oder: Eine schwedische Wikipedianerin war in Feuerland im Urlaub und hat einheimische Insektenarten fotografiert. Wie landen die Fotos jetzt in den entsprechenden Wikipedia-Artikeln in fünfzehn Sprachversionen?

View 0001-Run-new-batches-as-the-submitting-user.patch
From 38a7b52a3bb2d7d08639bdf46e5f3cba446fcde2 Mon Sep 17 00:00:00 2001
From: Lucas Werkmeister <>
Date: Thu, 18 Oct 2018 16:12:53 +0200
Subject: [PATCH] Run new batches as the submitting user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This adds a new table storing OAuth details for a batch, and populates
it when any new batch is created. When running commands for a batch,
lucaswerkmeister / setTransaction.js
Created Jun 6, 2018 set the transaction status of all items by the current user to a certain status
View setTransaction.js
* Set the transaction status of all items by the current user to the given status.
async function setTransaction(transaction) {
const userId = await fetch('', { credentials: 'include' })
.then(response => response.json())
.then(json => json._id);
const items = await fetch(`${userId}`)
.then(response => response.json())
.then(json => json.items);
lucaswerkmeister / filterLemmasWithSpace
Created May 26, 2018
commands to find Wikidata lemmas with a space
View filterLemmasWithSpace
while IFS=$'\t' read -r lid language lemma; do
if [[ $lemma = *' '* ]]; then
printf '%s\t%s\t%s\n' "$lid" "$language" "$lemma"

My packlist for Wikimedia events

  • power strip („Mehrfachsteckdose“)
  • Qurious Queryboo
  • swimming trunks, on the chance that there’s a pool around (they don’t take up much room)
  • …?
lucaswerkmeister / openrefine.service
Created Apr 14, 2018
systemd unit file for running OpenRefine as a system service
View openrefine.service
# /etc/systemd/system/openrefine.service
Description=OpenRefine data reconciliation tool
ExecStart=/opt/openrefine-2.8/refine -d %S/%p -x refine.headless=true
You can’t perform that action at this time.