Skip to content

Instantly share code, notes, and snippets.

View jhelgert's full-sized avatar
🏠
Working from home

Jonathan Helgert jhelgert

🏠
Working from home
View GitHub Profile
@jhelgert
jhelgert / dsur.py
Last active October 30, 2023 14:50
Implementation of the dwell-time aware sum-up rounding algorithm (DSUR)
import numpy as np
from numpy.typing import NDArray
def calculate_control_deviation(
control: int,
start_index: int,
end_index: int,
alpha: NDArray[np.float64],
beta: NDArray[np.int32],

Reducing integer multiplication into bitwise operations is a well known approach in order to accelerate things like matrix multiplication, see xy for instance.

One of the examples in xy is the following: Given a matrix $X \in \{ 0,1,2 \}^{m \times p}$, we want to calculate $X X^\top$ as fast as possible. Since matrix multiplication is basically just a couple of scalar products, we only consider the latter for the ease of clarity. On the other hand, the scalar product only consists of two operations: integer multiplication and integer addition. The former is computationally expensive, so we'd like to implement the integer multiplication $a \cdot b$ with $a, b \in \{0,1,2\}$ through bitwise operations.

@jhelgert
jhelgert / bbc_red_button.m3u8
Created July 2, 2022 05:25
[M3U8] All BBC Red Button Streams
#EXTM3U
#EXTINF:0,BBC RB 1
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/webcast/hls/uk/abr_hdtv/ak/sport_stream_01.m3u8
#EXTINF:0,BBC RB 2
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/webcast/hls/uk/abr_hdtv/ak/sport_stream_02.m3u8
#EXTINF:0,BBC RB 3
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/webcast/hls/uk/abr_hdtv/ak/sport_stream_03.m3u8
#EXTINF:0,BBC RB 4
http://a.files.bbci.co.uk/media/live/manifesto/audio_video/webcast/hls/uk/abr_hdtv/ak/sport_stream_04.m3u8
#EXTINF:0,BBC RB 5
from gurobipy import Model, GRB, quicksum as qsum
from scipy.optimize import linear_sum_assignment
import matplotlib.pyplot as plt
import numpy as np
import time
def build_LP(c):
mdl = Model()
# parameters

Following situation: We have scanned a two-sided document by first scanning all the front pages and then scanning all the pages on the other side. Now we have two PDFs front.pdf and back.pdf that we would like to merge.

Let's say our document consists of a total of 10 pages. Then we have:

front.pdf: p1   p3    p5   p7   p9
back.pdf : p2 p4 p6 p8
@jhelgert
jhelgert / remarkable_grid.tex
Created January 7, 2022 12:31
[LaTeX] Creates a simple reMarkable grid template
\documentclass[tikz]{standalone}
\pdfpkresolution=72
\begin{document}
\begin{tikzpicture}
% 1 px = 1bp
\draw[black!20, very thin, step=44px] (0,0) grid (1404bp, 1872bp);
\end{tikzpicture}
\end{document}
@jhelgert
jhelgert / kickbase_top11.md
Created October 3, 2021 12:02
Die jeweilige Kickbasespieltag-Top11 der Saison 2021/2022 mit zusätzlichen Nebenbedingungen.

Spieltag: 1, Gesamtpunkte: 3298, Max Spieler pro Team: 11:

                      E. Haaland (446)   A. Kramaric (355)                      
M. Reus (232)   P. Klement (306)   P. Förster (247)   W. Endo (240)   F. Kainz (330)
               M. Kempf (384)   B. Sosa (334)   M. Niakhate (204)               
                                M. Riemann (220)                                
@jhelgert
jhelgert / kickbase_punkte_2021_2022.csv
Last active September 30, 2021 14:44
Kickbasepunkte aller Spieler in der Saison 2021/2022 (Stand: 6. Spieltag)
vorname nachname verein position S1 S2 S3 S4 S5 S6 S7 S8 S9 S10 S11 S12 S13 S14 S15 S16 S17 S18 S19 S20 S21 S22 S23 S24 S25 S26 S27 S28 S29 S30 S31 S32 S33 S34
Niklas Süle FC Bayern DEFENDER 91.0 91.0 139.0 49.0 147.0 149.0
Manuel Neuer FC Bayern GOAL_KEEPER 67.0 73.0 140.0 103.0 153.0 115.0
Eric Maxim Choupo-Moting FC Bayern FORWARD 4.0 31.0 30.0 120.0 121.0
Sven Ulreich FC Bayern GOAL_KEEPER 0.0 0.0
Thomas Müller FC Bayern MIDFIELDER 38.0 136.0 283.0 52.0 233.0 186.0
Robert Lewandowski FC Bayern FORWARD 157.0 227.0 420.0 162.0 191.0 97.0
Leon Goretzka FC Bayern MIDFIELDER 97.0 88.0 167.0 101.0 296.0 120.0
Leroy Sané FC Bayern MIDFIELDER 85.0 51.0 103.0 211.0 306.0 96.0
Joshua Kimmich FC Bayern MIDFIELDER 200.0 135.0 184.0 177.0 401.0 251.0
@jhelgert
jhelgert / bundestagswahl2021.csv
Last active September 28, 2021 15:35
Unvollständige Wahlbezirksdaten der Bundestagswahl 2021 (3039/4492 Wahlbezirke). Quelle: https://wahlen.votemanager.de/
We can't make this file beautiful and searchable because it's too large.
,Bundesland,Stadt,Wahlbezirk,CDU,SPD,AfD,FDP,GRÜNE,DIE LINKE,CSU
0,Hessen,Aarbergen,Kettenbach,17.59,24.76,14.98,11.73,10.42,5.21,
1,Hessen,Aarbergen,Michelbach,22.91,22.48,16.06,12.21,13.06,4.71,
2,Hessen,Aarbergen,Hausen ü. Aar,17.78,25.0,13.89,12.22,12.22,5.0,
3,Hessen,Aarbergen,Rückershausen,23.79,32.04,14.08,10.19,6.8,3.88,
4,Hessen,Aarbergen,Panrod,25.58,22.87,10.85,16.28,9.3,1.94,
5,Hessen,Aarbergen,Daisbach,25.64,30.77,11.11,11.11,13.68,2.56,
6,Hessen,Aarbergen,B99091 Wahlbezirke 1 - 3 - 4,23.11,35.46,8.52,10.22,10.33,4.15,
7,Hessen,Aarbergen,B99092 Wahlbezirke 2 - 5 - 6,23.24,31.54,6.95,12.24,14.32,2.7,
8,Hessen,Aarbergen,Gemeinde Aarbergen,22.66,29.78,10.56,11.78,11.75,3.72,
@jhelgert
jhelgert / channels.conf
Created September 13, 2021 14:21
VDR sender list (SAT: Hotbird 13.0E)
TVP HD;CANAL+:10719:vC34M5O20S1:S13E:27500:167=27:109=pol@4;110,111:0:100,1813,1884,B01,500,1803,1861,186C,6ED,1870:4408:318:11000:0
TVP INFO HD;CANAL+:10719:vC34M5O20S1:S13E:27500:168=27:112=pol@4:0:0:4409:318:11000:0
Active Family;CANAL+:10719:vC34M5O20S1:S13E:27500:171=27:0;124:0:100,1813,1884,B01,500:4412:318:11000:0
CANAL+ 4K ULTRA HD;CANAL+:10719:vC34M5O20S1:S13E:27500:172=36:0;128,129,130:0;713:1884:4413:318:11000:0
Eleven Sports 1 4K;CANAL+:10719:vC34M5O20S1:S13E:27500:174=36:136=pol@4:0:1884:4415:318:11000:0
CANAL+ 4K ULTRA HD;CANAL+:10719:vC34M5O20S1:S13E:27500:172=36:0;128,129,130:0;713:1884:4463:318:11000:0
CANAL+ 4K ULTRA HD;CANAL+:10719:vC34M5O20S1:S13E:27500:172=36:0;128,129,130:0;713:1884:4464:318:11000:0
CANAL+ 4K ULTRA HD;CANAL+:10719:vC34M5O20S1:S13E:27500:172=36:0;128,129,130:0;713:1884:4465:318:11000:0
CANAL+ 4K ULTRA HD;CANAL+:10719:vC34M5O20S1:S13E:27500:172=36:0;128,129,130:0;713:1884:4473:318:11000:0
CANAL+ 4K ULTRA HD;CANAL+:10719:vC34M5O20S1:S13E:27500:172=36:0;128,129,130:0;713:188