GeistHaus
log in · sign up

GitHub - arcuru/pokem: A notification bot for Matrix. Listens on HTTP and forwards to Matrix. Similar to https://ntfy.sh

github.com

A notification bot for Matrix. Listens on HTTP and forwards to Matrix. Similar to https://ntfy.sh - arcuru/pokem

2 pages link to this URL
Cloning Windows Recall in 30 Lines of Bash

June 6, 2024 This is mostly a demonstration of what Windows Recall actually seems to do under the hood, and is not meant to be seriously used. Here’s the code, I have more to say after: #!/usr/bin/env bash if [ "$1" == "--daemon" ]; then MD5LAST="" while true; do # Use the current date and time for the screenshot filename FILE=~/recall/$(date +"%Y/%m/%d/%Y-%m-%d-%H:%M:%S") mkdir -p $(dirname $FILE) grim $FILE.png # Take a screenshot # If the screenshot is the same as the last one, disregard it MD5=$(md5sum $FILE.png | cut -d ' ' -f 1) if [ "$MD5" == "$MD5LAST" ]; then rm $FILE.png sleep 5 continue fi MD5LAST=$MD5 # Run tesseract on the file to extract text from the image # It always appends .txt to the filename, so the final name is $FILE.ocr.txt tesseract $FILE.png $FILE.ocr > /dev/null 2>&1 & sleep 5 done exit 0 fi # The arguments are assumed to be a ripgrep search query FILES=$(rg --files-with-matches $@ ~/recall) # Replace the filename extensions, which should be .ocr.txt, with .png FILES=${FILES//.ocr.txt/.png} mcomix $FILES When called with --daemon it will handle the screenshotting/OCR analysis, and when called with anything else it is interpreted as a ripgrep search.

0 inbound links article en post blogdeveloperpersonalBashPrivacyTools
Pok'em: Seamless Notifications with Matrix

# These three commands are all equivalent pokem !RoomID:jackson.dev Backup failed! pokem --room !RoomID:jackson.dev Backup failed! curl --fail -d "Backup failed!" pokem.dev/!RoomID:jackson.dev pokem Backup failed! # Will send to your configured default room pokem error Backup failed! # Will send to your configured room named "error" pokem --room error Backup failed! # Same as above # It also accepts stdin as the room message echo "Backup failed!" | pokem error # Sends to the room named "error" cat README.md | pokem # Send the contents of a file to the default room # Authentication # Inside Matrix, you can set a pokempassword using the bot interface. # If you do that, you won't be pinged at 3am by some rando, because even if # They can guess your roomid, they'll still need to include the password like so: curl --fail pokem.dev/roomid -d "poke the room" -H "Authentication: pokempassword" pokem --auth pokempassword --room roomid poke the room While writing Chaz and headjack, I realized that it would be pretty easy to build a self-hosted alternative to ntfy…

0 inbound links article en post blogdeveloperpersonal