Skip to content

Instantly share code, notes, and snippets.

View Jan-Zeiseweis's full-sized avatar

Jan Zeiseweis Jan-Zeiseweis

View GitHub Profile

Project Requirements Document

Project Name

MediaCatalog

Purpose

A program to catalog media files. I would like to use Python and my idea is to divide the project into several parts. 1. one part searches the hard disk for media files and reports found files to an API. 2. a backend with API which is responsible for the data management. 3. free end for searching the data and eventual analysis.

Features

  • List and manage media items (e.g., movies, music, books)
@Jan-Zeiseweis
Jan-Zeiseweis / data_unit_converter.py
Created March 7, 2025 11:51
Data Unit Converter
import re
# Umrechnungsfaktoren
BIN_PREFIX = {"ki": 1024, "mi": 1024**2, "gi": 1024**3, "ti": 1024**4,
"pi": 1024**5, "ei": 1024**6, "zi": 1024**7, "yi": 1024**8}
DEC_PREFIX = {"k": 1000, "m": 1000**2, "g": 1000**3, "t": 1000**4,
"p": 1000**5, "e": 1000**6, "z": 1000**7, "y": 1000**8}
# Regex zum Parsen der Eingabe
pattern = re.compile(r"^(\d+)([kmgtpezy]?i?)(bit|byte)$", re.IGNORECASE)
#!/bin/zsh
# Check if the correct number of arguments is provided
if [[ $# -ne 2 ]]; then
echo "Usage: $0 <directory> <password>"
exit 1
fi
# Read arguments
ARCHIVE_DIR="$1"
@Jan-Zeiseweis
Jan-Zeiseweis / mouse.py
Created December 30, 2024 20:38
usb-device-mouse interface
# MicroPython USB Mouse module with Scroll Wheel
# MIT license; Copyright (c) 2023-2024 Angus Gratton
from micropython import const
import struct
import machine
from usb.device.hid import HIDInterface
_INTERFACE_PROTOCOL_MOUSE = const(0x02)
@Jan-Zeiseweis
Jan-Zeiseweis / kill_wrapper.sh
Created November 3, 2023 18:48
kill_wrapper
#!/bin/bash
# run some program, and KILL it with deadly force upon ^C :) --sq5bpf
# this is a hack to make
CPID=0
intr() {
echo "killing $CPID"
kill -9 $CPID
}
@Jan-Zeiseweis
Jan-Zeiseweis / codestyle.xml
Created April 26, 2023 17:23
PyCharm code style.xml
<code_scheme name="Default" version="173">
<JSCodeStyleSettings version="0">
<option name="USE_SEMICOLON_AFTER_STATEMENT" value="false" />
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="SPACE_BEFORE_GENERATOR_MULT" value="true" />
<option name="REFORMAT_C_STYLE_COMMENTS" value="true" />
<option name="USE_DOUBLE_QUOTES" value="false" />
<option name="FORCE_QUOTE_STYlE" value="true" />
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
<option name="SPACES_WITHIN_IMPORTS" value="true" />
@Jan-Zeiseweis
Jan-Zeiseweis / remove_outdated_snaps.sh
Created September 23, 2021 08:45
Removes outdated snaps.
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
LANG=C snap list --all | awk '/disabled/{print $1, $3}' |
while read -r snapname revision; do
snap remove "$snapname" --revision="$revision"
done
" Settings
set nohud
set nosmoothscroll
set noautofocus " The opposite of autofocus; this setting stops
" sites from focusing on an input box when they load
set typelinkhints
let searchlimit = 30
let scrollstep = 70
let barposition = "bottom"
import cProfile
from datetime import datetime
def profileit(func):
def wrapper(*args, **kwargs):
datafn = f"{func.__name__}_{datetime.now().strftime('%Y%m%d_%H%M%S_%f')}.profile"
prof = cProfile.Profile()
retval = prof.runcall(func, *args, **kwargs)
prof.dump_stats(datafn)
// ==UserScript==
// @name Track Pageview
// @namespace deKexx
// @description Sends Url to a local server
// @include http://www.youtube.com/watch*
// @include https://www.youtube.com/watch*
// @connect popo.local
// @author Jan Zeiseweis
// @version 0.1
// @grant GM_xmlhttpRequest