Skip to content

Instantly share code, notes, and snippets.

@rrooij
rrooij / openapi.yaml
Created January 4, 2022 11:12
openapi terminusdb spec
openapi: 3.0.1
info:
title: TerminusDB API
description: API for TerminusDB
contact:
email: team@terminusdb.com
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 10.0.3
@rrooij
rrooij / filter.txt
Created December 16, 2021 11:48
Filteren van persoonlijk voornaamwoorden, lidwoorden etc.
de
en
van
het
we
in
een
voor
te
op
@rrooij
rrooij / swi_prolog_line_wrap.pl
Last active June 2, 2021 13:05
SWI Prolog wrap string in newlines
% wrap_string(+String, +PadLength, -Output) is det.
wrap_string(String, PadLength, Output) :-
string_length(String, StringLength),
wrap_string_(String, 0, PadLength, StringLength, "", Output).
wrap_string_(String, PadStart, PadWidth, StrLength, Acc, Output) :-
NewPadStart is PadStart + PadWidth,
( NewPadStart < StrLength
-> sub_string(String, PadStart, PadWidth, _, SubString),
format(string(NewAcc), "~s~s~n", [Acc, SubString]),
wrap_string_(String, NewPadStart, PadWidth, StrLength, NewAcc, Output)
@rrooij
rrooij / concurrent_forall_8.2.3.patch
Created January 8, 2021 09:41
Concurrent testing PLUnit SWI Prolog
diff --git a/plunit.pl b/plunit.pl
index 06776b8..155d935 100644
--- a/plunit.pl
+++ b/plunit.pl
@@ -611,7 +611,7 @@ run_unit(Spec) :-
-> info(plunit(blocked(unit(Unit, Reason))))
; setup(Module, unit(Unit), UnitOptions)
-> info(plunit(begin(Spec))),
- forall((Module:'unit test'(Name, Line, Options, Body),
+ concurrent_forall((Module:'unit test'(Name, Line, Options, Body),
@rrooij
rrooij / low_battery_cron.sh
Created August 12, 2019 17:01
Cron for checking battery life
#!/bin/sh
# Change BAT according to the battery you want to check
BATCAP=$(cat /sys/class/power_supply/BAT1/capacity)
WARNING_THRESHOLD=$1
export DISPLAY=:0
if [ -z "$WARNING_THRESHOLD" ]; then
WARNING_THRESHOLD=20
@rrooij
rrooij / retrieve_tld.sh
Created June 28, 2019 08:29
Retrieve TLD's from Wikipedia
curl -s 'https://en.wikipedia.org/wiki/List_of_Internet_top-level_domains' | egrep '\/wiki\/\.\w+' -o | sed 's/\/wiki\///'
@rrooij
rrooij / checksum.py
Created May 22, 2017 16:23
Checksum Python
def sum16_checksum(bytes, big=True):
sum = 0
count_to = len(bytes)
count = 0
while count_to > count:
value = bytes[count + 1] + bytes[count]
sum = sum + value
count = count + 2
@rrooij
rrooij / README.md
Last active May 17, 2021 02:49
Script for cycling through messages in mpv

cycle_messages

Cycles through predefined messages and displays them on the OSD. This script can be useful for notifying actions you made with custom keybindings for your OS.

The predefined values should be changed by your own messages.