Skip to content

Instantly share code, notes, and snippets.

View mschmitt's full-sized avatar
🥾
Busier than a one-legged man in an ass-kicking contest.

Martin Schmitt mschmitt

🥾
Busier than a one-legged man in an ass-kicking contest.
View GitHub Profile
@mschmitt
mschmitt / day-night-detection.cron
Last active October 7, 2021 09:44 — forked from webghostx/day-night-detection.py
day/night detection for cron jobs
# Run every minute and do things IF NOT night.
* * * * * (is_night || do_things) >/dev/null 2>&1
# Run every hour and do things IF night.
0 * * * * (is_night && do_things) >/dev/null 2>&1
@mschmitt
mschmitt / dashcat
Last active August 9, 2022 18:31
dashcat can be used to concatenate dashcam videos
#!/usr/bin/env bash
# dashcat can be used to concatenate dashcam videos
overlap=1
function cleanup(){
trap - INT QUIT TERM EXIT
rm -v -f "${playlist_temp}"
for t in "${video_temp[@]}"

"Mobilnummern zwecks Pseudonymisierung hashen"

Gültige Mobil-Prefixe besorgen:

lynx --dump https://www.bundesnetzagentur.de/DE/Sachgebiete/Telekommunikation/Unternehmen_Institutionen/Nummerierung/Rufnummern/MobileDienste/zugeteilte%20RNB/MobileDiensteBelegteRNB_Basepage.html | sed -n 's/(0)/+49/p' | sed 's/-//' | awk '{print $1}' | grep ^+49 > numbers.prefixes.txt

Beispieltelefonnummern generieren mit 7 Stellen nach der Vorwahl:

for i in $(shuf numbers.prefixes.txt); do printf "%s%.7i\n" "${i}" "${RANDOM}"; done > numbers.randomnumbers.txt

@mschmitt
mschmitt / git-credential-azdo-token
Created January 27, 2021 18:16
A git credential helper for a shared user that needs to authenticate to distinct Azure Devops users with their distinct tokens, depending on which user is using the shared user. Don't use this, find a better job instead, where people pay some basic respect to you and your work.
#!/bin/bash
# Process only the get requests to this credential helper.
# https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage
# git config credential.helper 'azdo-token'
[[ "${1}" == "store" ]] && exit 0
[[ "${1}" == "erase" ]] && exit 0
want_username="${SUDO_USER}"
printf -v want_aes_file "%s/.azdo-token-for-%s.aes" "${HOME}" "${want_username}"
@mschmitt
mschmitt / gone.txt
Last active March 5, 2021 21:47
Scriptable.app widget for monitoring go-eCharger(s)
Neuer Link: https://github.com/mschmitt/go-e-widget
@mschmitt
mschmitt / JavaHome.jar
Last active January 5, 2021 17:41
Find current JVM, either from java builtin property or from $JAVA_HOME
@mschmitt
mschmitt / go-e-zaehlerstand
Last active December 18, 2020 14:48
Zählerstand der go-e Wallbox auslesen
#!/bin/bash
url="http://go-echarger/status"
#url="https://api.go-e.co/api_status?token=abcdef0123"
if [[ "${url}" =~ api.go-e.co ]]
then
dataobject='.data'
else
dataobject='.'
@mschmitt
mschmitt / lukspass.sh
Created October 24, 2020 10:28
Programmatically changing a cryptsetup LUKS key
#!/bin/bash
luksobject='crypto.dat'
read -r -s -p 'Old passphrase: ' old
printf "\n"
read -r -s -p 'New passphrase: ' new
printf "\n"
read -r -s -p 'New passphrase again: ' new2
printf "\n"
@mschmitt
mschmitt / rki.sh
Last active October 14, 2020 18:49
#!/bin/bash
BASH_LOADABLES_PATH=/usr/lib/bash:/usr/local/lib/bash
enable -f finfo finfo
declare -A query_counties
query_counties['Gießen']='https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?where=county%20%3D%20%27LK%20GIESSEN%27&outFields=cases7_per_100k&outSR=4326&f=json'
query_counties['Frankfurt']='https://services7.arcgis.com/mOBPykOjAyBO2ZKk/arcgis/rest/services/RKI_Landkreisdaten/FeatureServer/0/query?where=county%20%3D%20%27SK%20FRANKFURT%20AM%20MAIN%27&outFields=cases7_per_100k&outSR=4326&f=json'
query_counties['Amsterdam']='https://services.arcgis.com/nSZVuSZjHpEZZbRo/arcgis/rest/services/COVID19_gemeente_actueel_vlak/FeatureServer/0/query?f=json&where=Gemeentenummer%3D363&returnGeometry=false&spatialRel=esriSpatialRelIntersects&outFields=Total_reported_delta7_100k'
out="Covid-19-Fälle 7 Tage auf 100000:"
@mschmitt
mschmitt / geofency-toggl-helper
Last active September 1, 2020 16:00
A helper for clocking in and out of a Toggl project from a Geofency webhook
#!/usr/bin/haserl --shell=/bin/bash --accept-all
/*
A helper for clocking in and out of a Toggl project from a Geofency webhook.
Pass the following Arguments as a GET query string:
User/Password UP= (Your API token plus ":api_token")
Workspace WS=