Skip to content

Instantly share code, notes, and snippets.

View jbaiter's full-sized avatar

Johannes Baiter jbaiter

View GitHub Profile
@jbaiter
jbaiter / azul.lua
Created April 12, 2020 09:16
TableTop Simulator: Scripted Azul
--[[ Lua code. See documentation: https://api.tabletopsimulator.com/ --]]
#include <vscode/console>
tileDiffuseUrls = {}
tileDiffuseUrls["http://cloud-3.steamusercontent.com/ugc/967597347416754435/BA4334969D1AD4E8B146AE7E7A1A430F14C7A5DA/"] = "yellow"
tileDiffuseUrls["http://cloud-3.steamusercontent.com/ugc/967597347419272946/C8F005A109AAD820E38A8E377F1026074B830401/"] = "turquois"
tileDiffuseUrls["http://cloud-3.steamusercontent.com/ugc/967597347419272641/EE644ECD0ADC6C78AC61E0C538BAF98FD8703908/"] = "red"
tileDiffuseUrls["http://cloud-3.steamusercontent.com/ugc/967597347419272833/D4C93372171EBA7604524C0E6B6DA29347B5209A/"] = "blue"
tileDiffuseUrls["http://cloud-3.steamusercontent.com/ugc/967597347419273056/A03D249CF12867EB4134A9A7E9A9D2A1632EE704/"] = "black"
@jbaiter
jbaiter / wg-monitor.py
Last active May 25, 2023 13:29
Structured Logging and Prometheus Exports for Wireguard sessions
#!/usr/bin/env python3
"""Wireguard logging and monitoring tool.
Logs the following events along with the peer state in JSON format to stdout:
- Peer connected (= successfull handshake after period of no handshakes)
- Peer disconnected (= no handshake for longer than 5 minutes)
- Peer roamed (= source IP of the peer changed)
Additionally, the tool exposes a Prometheus-compatible monitoring endpoint
on port 9000 that exports the following metrics:

class: center, middle

Modernes JavaScript

Teil I: Basics


Agenda

  1. Deklaration von Variablen
  2. Funktionen
@jbaiter
jbaiter / solrstats
Last active July 12, 2018 05:30
Print size distribution of your Solr index
#!/usr/bin/env python3
# coding=utf8
"""
CFE file layout:
Header:
CodecHeader:
Magic [4byte uint32]
Codecname [?byte String]
Version [4byte uint32]
@jbaiter
jbaiter / 99-powerbank.rules
Last active January 11, 2021 21:38
Small script to inhibit charging when powering a USB-PD Thinkpad with a USB-C powerbank.
ACTION=="change", SUBSYSTEM=="power_supply", RUN+="/usr/local/sbin/powerbank"
.window-manifest-navigation > .mirador-btn.mirador-icon-download {
color: #929191;
margin-right: 5px;
width: 30px;
}
.window-manifest-navigation > .mirador-btn.mirador-icon-download:hover {
color: black;
}
import json
import logging
import sys
import time
from pathlib import Path
from gensim.models.fasttext import FastText
from gensim.models.word2vec import Text8Corpus
(function ($){
$.ElucidateEndpoint = function (options) {
jQuery.extend(this, {
token: null,
container: options.container,
url: options.url,
dfd: null,
// OA list for Mirador use
annotationsList: [],
@jbaiter
jbaiter / rate-limit.lua
Created January 23, 2018 16:10
Simple Nginx Rate Limiting with Lua, redis and redis-cell
-- Requires the `redis-cell` module to be installed in Redis: https://github.com/brandur/redis-cell
local redis = require "nginx.redis"
local red = redis:new()
red:set_timeout(1000)
local ok, err = red:connect("127.0.0.1", 6379)
if not ok then
ngx.log(ngx.ERR, "failed to connect to redis: ", err)
ngx.exit(ngx.HTTP_INTERNAL_SERVER_ERROR)

archiscribe-corpus

This is the corpus repository for https://archiscribe.jbaiter.de.

The goal is to have as much diverse OCR ground truth for 19th Century German prints as possible.

Currently the corpus contains 123 lines from 3 works published across 3 years. Detailed statistics are available below.