Skip to content

Instantly share code, notes, and snippets.

View lucaswerkmeister's full-sized avatar

Lucas Werkmeister lucaswerkmeister

View GitHub Profile
@lucaswerkmeister
lucaswerkmeister / setTransaction.js
Created June 6, 2018 16:55
inventaire.io: set the transaction status of all items by the current user to a certain status
/**
* Set the transaction status of all items by the current user to the given status.
*/
async function setTransaction(transaction) {
const userId = await fetch('https://inventaire.io/api/user', { credentials: 'include' })
.then(response => response.json())
.then(json => json._id);
const items = await fetch(`https://inventaire.io/api/items?action=by-users&users=${userId}`)
.then(response => response.json())
.then(json => json.items);
@lucaswerkmeister
lucaswerkmeister / filterLemmasWithSpace
Created May 26, 2018 21:47
commands to find Wikidata lemmas with a space
#!/bin/bash
while IFS=$'\t' read -r lid language lemma; do
if [[ $lemma = *' '* ]]; then
printf '%s\t%s\t%s\n' "$lid" "$language" "$lemma"
fi
done

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
lucaswerkmeister / openrefine.service
Created April 14, 2018 12:30
systemd unit file for running OpenRefine as a system service
# /etc/systemd/system/openrefine.service
[Unit]
Description=OpenRefine data reconciliation tool
Documentation=http://openrefine.org/
[Service]
ExecStart=/opt/openrefine-2.8/refine -d %S/%p -x refine.headless=true
DynamicUser=yes
NoNewPrivileges=yes
StateDirectory=%p
@lucaswerkmeister
lucaswerkmeister / Makefile
Created April 11, 2018 21:55
Example of combining LilyPond, LaTeX, listings and beamer.
.PHONY: all
all: lilypond.pdf
%.tex: %.lytex
lilypond-book --pdf $<
%.pdf: %.tex
pdflatex $<
@lucaswerkmeister
lucaswerkmeister / geoclue-sandbox.conf
Last active March 25, 2018 20:38
systemd sandboxes for three services I found running as unsandboxed root on my desktop system.
# /etc/systemd/system/geoclue.service.d/sandbox.conf
# I have no idea what this service needs, but hopefully we can at least sandbox it a little bit…
[Service]
RuntimeDirectory=%p
ProtectSystem=strict
ProtectHome=yes
InaccessiblePaths=-/etc/shadow -/etc/gshadow -/var/lib/sudo -/etc/ssh -/etc/opendkim -/var/lib/tor
PrivateTmp=yes
ProtectKernelTunables=yes
ProtectControlGroups=yes
@lucaswerkmeister
lucaswerkmeister / Makefile
Last active March 22, 2018 22:47
Running the LilyPond development version inside a container
.PHONY: all
CFLAGS := -Wall -Wextra -Wpedantic -Werror
all: the-score.pdf
the-score.pdf: the-score.ly lilypond-git
./lilypond-git $< $@
# based on Make’s implicit rule, search for %: in make -p
@lucaswerkmeister
lucaswerkmeister / README.md
Last active March 15, 2018 17:49
Workaround for \displaceHeads on notes with beams

The \displaceHeads command from LilyPond snippet 861 doesn’t work correctly with notes that have beams – it removes the beam, probably due to a LilyPond bug (see here for details). This version can be used instead – it’s not as correct (the width of the beam is hard-coded), but it seems to work. (Only use it if you’re actually affected by this problem, of course, otherwise stick with the original!)

SPARQL wishlist

WORK IN PROGRESS

(But perhaps I’ll eventually submit this to the public-sparql-dev W3C mailing list…)

ordering in aggregate functions

This ends up being essentially the same proposal, but with two different motivations, so please bear with me for a moment :)

@lucaswerkmeister
lucaswerkmeister / Makefile
Created February 23, 2018 23:37
little experiment on returning extra error information from functions in C
.PHONY: all
CFLAGS := -std=c99 -Wall -Wextra -Wpedantic
all: countdown