Skip to content

Instantly share code, notes, and snippets.

View lucaswerkmeister's full-sized avatar

Lucas Werkmeister lucaswerkmeister

View GitHub Profile
@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
@lucaswerkmeister
lucaswerkmeister / exportWatchlist.js
Created February 18, 2018 13:30
Export Special:EditWatchlist’s state before submitting the page
( function() {
let list = '';
for ( let checkbox of document.querySelectorAll( 'input[type=checkbox]' ) ) {
let checked = checkbox.checked,
title = checkbox.value,
labelElement = checkbox.nextElementSibling.querySelector( 'a' ),
text;
if ( !labelElement ) {
labelElement = checkbox.nextElementSibling;
}
@lucaswerkmeister
lucaswerkmeister / README.md
Last active July 18, 2018 20:57
Automatic pacman updates

I use these files to keep my package manager metadata up to date. pacman-update automatically downloads package updates so that I don’t have to wait for the download when I actually go to upgrade the system, pacman-mirrorlist-update makes sure that the mirror list is not too outdated, and the tmpfiles.d configuration makes sure that all the updates downloaded by pacman-update (which may include many intermediate versions if I don’t upgrade for a while) don’t stay around forever.

To set up these files, copy the .service and .timer files into /etc/systemd/system/, and the pacman.conf file into /etc/tmpfiles.d/.

@lucaswerkmeister
lucaswerkmeister / WDQS Workshops.md
Last active January 3, 2018 23:42
possible basic structure of a Wikidata Query Service workshop

WDQS Workshops

Basic structure of one of my Wikidata Query Service workshops, or rather, idealized version of it that I hope to get close to :)

  • before the workshop: zoom in on all domains you’re likely to visit, at least www.wikidata.org and query.wikidata.org, until text is readable from the back of the audience (I usually go for ~150%).
@lucaswerkmeister
lucaswerkmeister / diseases.shex
Last active October 27, 2017 11:11
Shape Expression for Diseases in Wikidata
# Shape Expression for Diseases in Wikidata
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX do: <http://purl.obolibrary.org/obo/DOID_>
@lucaswerkmeister
lucaswerkmeister / sandbox.conf
Created October 22, 2017 13:56
systemd sandbox for apache2.service on Debian Stretch (systemd v232)
[Service]
# read /var/lib/dehydrated/
CapabilityBoundingSet=CAP_DAC_OVERRIDE
# bind port 80 + 443
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
# drop privileges to www-data
CapabilityBoundingSet=CAP_SETUID CAP_SETGID
# call ulimit
CapabilityBoundingSet=CAP_SYS_RESOURCE
# partially mitigate CAP_DAC_OVERRIDE
@lucaswerkmeister
lucaswerkmeister / keybase.md
Created October 4, 2017 22:19
What Keybase team members can and can’t do
  • Team members can read previous chat history.
  • Team members can delete files created by other people.
  • Team members can’t see open invitations.
  • Team members can force-push to repositories.
  • Writers can create repositories but can’t delete them.
@lucaswerkmeister
lucaswerkmeister / dumpMemcached
Created September 25, 2017 17:03
pure Bash script to dump all keys in a memcached server
#!/bin/bash
# connect to memcached
exec 3<>/dev/tcp/"${1:-localhost}"/"${2:-11211}" || exit $?
# get slab numbers
printf 'stats slabs\r\n' >&3
slabnums=()
while IFS=' :' read -r stat slabnum _; do
if [[ $stat == $'END\r' ]]; then