Skip to content

Instantly share code, notes, and snippets.

View mathklk's full-sized avatar

Mathis Kölker mathklk

  • 🇩🇪
View GitHub Profile
@mathklk
mathklk / README.md
Created May 13, 2026 08:49
Qt Heatmap Chart

Qt Heatmap Chart

Qt does not natively support drawing heatmaps / spectrograms to a QChart. This gist implements a self contained heatmap function that draws your data to a QImage using the jet color scheme. The image is set as the background of the chart. It also supports labels and value ranges for the axes.

grafik
@mathklk
mathklk / Porofessor_Ad_Removal.md
Created March 15, 2026 20:58
Porofessor Ad Removal

Porofessor Ad Removal

This guide shows how to remove ads from the Porofessor Overwolf extension. Tested with porofessor version 2.14.6

This may violate Overwolfs and Porofessors terms of service. I am not responsible for any consequences if you do this.

1. Stop Porofessor and Overwolf

@mathklk
mathklk / .bashrc
Created February 26, 2024 14:41
PS1
# Red background if previous command failed
get_err_color() {
if [ $? -ne 0 ]; then
echo -e "\033[41m"
fi
}
# Red background if on master/main
get_git_branch_color() {
branch=$(__git_ps1 %s)
import sys
import subprocess
import os
import shutil
assert len(sys.argv) == 2, "Usage: lddpack.py <executable>"
exe = sys.argv[1]
dir = "./" + exe + ".lddpack"
if not os.path.exists(dir):
@mathklk
mathklk / opencv_mat_type_lookup.cpp
Last active July 25, 2023 08:19
OpenCV Mat type lookup
/*
OpenCV type lookup
This is a simple lookup table to get the matching string for an OpenCV type macro.
It's useful when reading Mats and you want to verify the data type it has.
This table is dumb and it does the job.
Note that the base type is equal to its one-channel variant. I have decided to keep the one-channel variant.
(e.g. `CV_8U` and `CV_8UC1` are represented by the same integer)
@mathklk
mathklk / watershedTypeAssertion.py
Last active June 23, 2023 07:39
Verifies that the input arrays for OpenCV's watershed method have the correct size and data type
def watershedTypeAssertion(src: np.ndarray, markers: np.ndarray):
"""
Verifies that the input arrays for OpenCV's watershed method have the correct size and data type
(The error messages produced by OpenCV itself are not very clear on what has gone wrong)
"""
assert src.shape[0] > 0, f"src image must have more than 0 rows (has {src.shape[0]})"
assert src.shape[1] > 0, f"src image must have more than 0 cols (has {src.shape[1]})"
assert src.shape[2] == 3, f"src image must have exactly 3 channels (has {src.shape[2]})"
assert src.dtype == np.uint8, f"src image must be of dtype uint8 (is dtype {src.dtype})"
@mathklk
mathklk / RealSense Python class.md
Last active March 15, 2023 09:05
RealSense Python class

RealSense Python Class

This Python class is a wrapper based on pyrealsense2. It's intended to make interfacing with the Intel RealSense cameras easier and with a more object oriented approach.

ShortRangePreset.json is a preset like the default presets that allows for optimal depth images at short ranges (Intended for D43x).

@mathklk
mathklk / r
Created October 20, 2022 14:28
Minimal script to resolve domain names in the windows environment from WSL
#!/mnt/c/Users/User/AppData/Local/Programs/Python/Python39/python.exe
import sys
import subprocess
print(subprocess.check_output(['ping','-n','1']+sys.argv[1:]).decode('ansi').split('[')[1].split('%')[0].split(']')[0],end='')