Skip to content

Instantly share code, notes, and snippets.

View m-rey's full-sized avatar
🏳️‍⚧️
Hack the planet!

Mæve Rey m-rey

🏳️‍⚧️
Hack the planet!
  • Nuremberg, Germany
View GitHub Profile
@m-rey
m-rey / spellcheck_en.py
Last active May 11, 2022 13:52
hacky spellcheck that uses rules from languagetool and suggests corrections
#!/bin/env python3
# this needs https://github.com/bminixhofer/nlprule to work:
# pip install nlprule
from nlprule import Tokenizer, Rules
from sys import argv
LANG = "en"
@m-rey
m-rey / grep_fediverse_ids
Created January 31, 2022 20:17
get mastodon ids from mastodon source. run this grep on any html (part) to return all fediverse acc ids. Perfect to dump your user lists
grep -oP '(?<=display-name__account">).*?(?=</span>)'
@m-rey
m-rey / kvb_aerztesuche.md
Created November 10, 2021 02:39
KVB Ärztesuche Info

KVB Ärztesuche

Hier ein paar infos zur KVB Ärztesuche:https://dienste.kvb.de/arztsuche/app/erweiterteSuche.htm

Nachdem das Suchformular entsprechend ausgefüllt wurde, wird ein POST request mit den Daten verschickt. Man kann daraus aber problemlos auch ein GET request machen: https://dienste.kvb.de/arztsuche/app/erweiterteSucheAusfuehrung.htm?fachgebiete=&name=&adresse=N%C3%BCrnberg&arztArt=&geschlecht=&sprechzeitenTag=&barrierefreiheit=&zustatzBezeichnungen=&zusatzWeiterbildungen=&genehmigungen=Verhaltenstherapie+Erwachsene&genehmigungen=Verhaltenstherapie+Erwachsene%2C+Gruppe&fremdsprachen=&bezirksstellen=&landkreise=&bsnrLanrHnr=&geocodeResult=&geoTest=

Besser noch wäre es, wenn man den Bezirk+Landkreis noch auswählt. Da ist die Suche etwas kaputt und graut die option aus. Einfach im source code enablen und die gewüsnchten Dinge auswählen. Als request kanns dann so aussehen (wenn Landkreis angegeben, ist Ort nicht mehr notwendig): https://dienste.kvb.de/arztsuche/app/erweiterteSucheAusfuehrung.htm?fachg

@m-rey
m-rey / ublock_gen_seq_dynamic_rules.sh
Created July 23, 2021 10:35
generate and check ublock origin dynamic rules for CDNs using multiple hostnames containing sequentially numbered hostnames. Only online hostnames will be returned.
echo osm{0..100}.openstreetmap.fr | tr " " "\n" | parallel -j10 'ping -c 1 {} >/dev/null 2>&1 && echo \* {} \* noop' | sponge | sort
@m-rey
m-rey / garmin_update_maps.sh
Created July 7, 2021 15:56
download OpenStreetMap based maps for Garmin devices
#!/bin/sh
# USAGE
# garmin_update_maps FILE_WITH_URLS_TO_IMG.ZIP_MAP_FILES
# download map updates if available using URL list file (freizeitkarte-osm.de has some direct links available)
aria2c --conditional-get true --allow-overwrite --optimize-concurrent-downloads --file-allocation=none --enable-http-pipelining -i "$1"
# extract and rename map image files
for zip in *.zip; do
@m-rey
m-rey / parse_local_mimetype.zsh
Created June 18, 2021 13:53
parse local .desktop files for MIME types and output thom ordered by frecuency. You may have to adjust your shell config or the code to either enable globbing or rewrite the oneliner.
#!/bin/zsh
grep -hoP '(?<=MimeType=).*(?=(;|\n))' ~/.local/share/applications/**/*.desktop /usr/share/applications/**/*.desktop | tr ';' '\n' | tr -d "[:blank:]" | sort | uniq -c | sort -n
@m-rey
m-rey / merge_kdbx.sh
Last active June 18, 2021 16:04
function to bulk merge KeepassXC DBs (*.kdbx)
#!/bin/sh
# DESCRIPTION
# Merge one or more KeepassXc DBs into another KeepassXC DB.
#
# PURPOSE
# Syncthing can't natively merge/rebase KeepassXC DB files (yet?), thus it sometimes
# falls back to saving all differing DB versions as file sync conflicts.
# Luckily, `keepassxc-cli` *can* merge one DB into another, but only one at a time.
# As Syncthing often creates many conflict files, it would take ages to manually merge
#!/bin/bash
fonts_dir="${HOME}/.local/share/fonts"
if [ ! -d "${fonts_dir}" ]; then
echo "mkdir -p $fonts_dir"
mkdir -p "${fonts_dir}"
else
echo "Found fonts dir $fonts_dir"
fi
@m-rey
m-rey / waybar_minecraft.json
Created April 14, 2021 21:02
waybar minecraft module
"custom/minecraft": {
"format": "⬢ {}",
"interval": 10,
"exec": "printf '\\x06\\x00\\x00\\x00\\x00\\x00\\x01\\x01\\x00' | nc -N $SERVER_IP $SERVER_PORT | tr -cd '[:print:]' | jq -r '.players.online, .players.max'| xargs printf '%d/%d'",
"on-click": "printf '\\x06\\x00\\x00\\x00\\x00\\x00\\x01\\x01\\x00' | nc -N $SERVER_IP $SERVER_PORT | tr -cd '[:print:]' | jq -r '.players.sample[] | .name' | xargs -0 notify-send 'online users'",
"on-click-right": "flatpak run org.tlauncher.TLauncher"
}