Skip to content

Instantly share code, notes, and snippets.

@cboulanger
cboulanger / hedgedoc-background.css
Last active May 17, 2024 06:07
Hedgedoc CSS to specify a common background image in CSS instead of manually and set an opacity to the background except for the title page
/* set the background image for all pages which have an (empty) <!-- .slide: data-background="" --> marker */
/* create overlay with background image */
.slide-background-content::before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-image: url("image-url");
@cboulanger
cboulanger / parse-easychair-program.py
Created November 9, 2023 10:13
Parse an EasyChair conference programme to create a separate track overview. This requires a consistent naming scheme for the sessions. Cannot be used as-is.
import dateparser
import re
import requests
from bs4 import BeautifulSoup
import csv
from collections import defaultdict
url = "https://easychair.org/smart-program/<conference_name>/program.html"
track_url = "https://easychair.org/smart-program/<conference_name>/de_tracks.html"
css_url = "https://easychair.org/smart-program/<conference_name>/program.css"
@cboulanger
cboulanger / textual-schema-visualization.cypher
Created October 18, 2023 15:53
Neo4J Text-only equivalent for CALL db.schema.visualization()
// written with the help of ChatGPT4
MATCH (n)-[r]->(m)
WITH DISTINCT labels(n) AS ln, type(r) AS rt, labels(m) AS lm
WITH "(" + apoc.text.join(ln, ":") + ")-[:" + rt + "]->(" + apoc.text.join(lm, ":") + ")" AS CypherPathExpression
RETURN apoc.text.join(COLLECT(CypherPathExpression), '\n') AS GraphDataModel
@cboulanger
cboulanger / fetch-chrome-url.py
Created August 24, 2023 17:14
Get latest chrome or chromedriver download URLs
# written by GPT4
import requests
import json
import platform
import sys
import argparse
def get_latest_stable_version():
url = "https://googlechromelabs.github.io/chrome-for-testing/last-known-good-versions.json"
response = requests.get(url)
@cboulanger
cboulanger / sessions_by_track.py
Created June 20, 2023 14:08
Create a list of sessions ordered by tracks from an easychair.org conference programme
import dateparser
import re
import requests
from bs4 import BeautifulSoup
import csv
from collections import defaultdict
url = ".../program.html"
track_url = ".../tracks.html"
css_url = "..../program.css"
@cboulanger
cboulanger / install.sh
Last active March 17, 2023 07:26
String similarity with Ruby + Sqlite (Levenshtein distance / edit distance)
# see https://github.com/sparklemotion/sqlite3-ruby/issues/383#issuecomment-1473000796
SQLTITE_EXTENSIONS_DIR=/opt/sqlite-extensions # must exist
cd /tmp
git clone https://github.com/sqlite/sqlite.git
cd sqlite
gcc -g -fPIC -shared ./ext/misc/spellfix.c -o spellfix.o
sudo mv spellfix.o $SQLTITE_EXTENSIONS_DIR
rm -rf sqlite # clean up
@cboulanger
cboulanger / install-rbenv-pyenv.sh
Last active March 30, 2023 14:29
Install ruby 3.2.1 via rbenv on ubuntu and python 3.11 via pyenv - run as root!
#!/usr/bin/env bash
# run as root user
apt install -y git ruby-dev curl
# RUBY
cd ~
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
echo 'eval "$(~/.rbenv/bin/rbenv init - bash)"' >> ~/.bashrc
library(tidyverse)
library(tidytext)
library(xts)
library(tstools)
base_dir = "C:\\Users\\Boulanger\\ownCloud\\Abteilung 3\\Projekte\\Legal Theory Graph"
corpus_dirs = c()
for (dir in list.dirs(base_dir)) {
if (dir != base_dir) {
corpus_dirs = c(corpus_dirs, dir)
ref | 4 Giordano, in: Mecklenburg (Hrsg.), Handbuch deutscher Rechtsextremismus, 1996,
| S. 14; auch Hoffmann-Riem, NJW 2004, 2777 (2778) wirft vor, die deutsche Gesell-
| schaft habe „bei der Aufarbeitung dieser Vergangenheit weithin versagt“; Falk, Ent-
| nazifizierung und Kontinuität, 2017, S. 14 spricht von einer „Verdrängung von all
| dem, was mit der NS-Zeit negativ in Verbindung gebracht werden konnte.“; zu den
| Schwierigkeiten bei der Entnazifizierung auch Görtemaker/Safferling, Die Akte Ro-
| senburg, 2016, S. 63 ff.; vgl. auch Bauer, Die Wurzeln faschistischen und nationalso-
| zialistischen Handelns, 1961, S. 7.
| 5 Dazu die akribische Aufbereitung von Will, Ephorale Verfassung, 2017.
| 6 Salzborn, Rechtsextremismus, 2. Aufl. 2015, S. 36 f.
signal_phrases = [[
"see", "cf.", "e.g.", "compare", "on", "for example",
"on the contrary", "on the other hand",
"generally", "similarly", "alternatively",
"the discussion in", "regarding", "on this, see",
"also", "although", "as discussed in", "detailed", "described", "cited in", "by",
"first published as", "reprinted in"
], [
"siehe", "s.", "vgl.", "vgl",
"vgl. nur", "vgl", "zum ganzen", "so z.b.", "so auch", "bei",