Skip to content

Instantly share code, notes, and snippets.

@frederikstroem
frederikstroem / sieve_filter.txt
Created February 28, 2024 14:59
SimpleLogin auto-label Sieve filter (created & tested for ProtonMail)
# `envelope` command `from` retrieves `return-path` header, e.g. "4very3random2string1@simplelogin.co".
# Sources:
# - https://proton.me/support/sieve-advanced-custom-filters
# - https://simplelogin.io/docs/getting-started/troubleshooting/
# Require `envelope` and `fileinto` extensions.
require ["fileinto", "envelope"];
# Emails from SimpleLogin domains are filed into "SimpleLogin".
if envelope :domain :is "from" ["simplelogin.co", "simplelogin.io"] {
@frederikstroem
frederikstroem / waiting_service.service
Created January 16, 2024 22:59
Wait for Tailscale/Headscale backend to start before starting Systemd user service
[Unit]
Description=Waiting for Tailscale Backend
[Service]
Type=simple
EnvironmentFile=%h/waiting_service/.env
ExecStartPre=/usr/bin/bash -c 'until [[ "$(tailscale status --json | jq -r '.BackendState')" == "Running" ]]; do sleep 1; done' # Wait for Tailscale/Headscale to start.
ExecStart=/usr/bin/python3 %h/waiting_service/main.py
Restart=always
RestartSec=5
@frederikstroem
frederikstroem / automated_github_cloner.service
Created December 13, 2023 22:43
2023-12-13 snapshot of automated GitHub cloning tool. Clone or pull all GitHub repositories (submodules included) and Gists across all GitHub organizations and personal account every x hours. Discord webhook on errors. Script is hacked together and unstable!
[Unit]
Description=Automated GitHub cloning tool
[Service]
Type=simple
Environment=DATA_DIR=/tank/automated_github_cloner
EnvironmentFile=%h/automated_github_cloner/.env
ExecStart=/usr/bin/python3 %h/automated_github_cloner/main.py
Restart=always
RestartSec=5
@frederikstroem
frederikstroem / tts
Last active August 2, 2023 20:36
Cogai TTS using docker & script placed at ~/.local/bin/tts
#!/usr/bin/env bash
# Test: `echo "This should be read up for me" | tts`
# Read all input into variable and replace newlines with spaces
input=$(cat | tr '\n' ' ')
# Save current time in ISO8601 format and replace special characters with underscore
timestamp=$(date -u +"%Y_%m_%dT%H_%M_%SZ")
@frederikstroem
frederikstroem / joplin_vscode_workspace.md
Last active April 30, 2023 12:18
Joplin Note and VS Code Workspace

Joplin Note and VS Code Workspace

Configure Joplin's external editor settings to open a specific workspace in Visual Studio Code when editing notes.

Path (Linux): /usr/bin/code

Arguments: --wait --new-window /home/your_username/copilot-powered.code-workspace

@frederikstroem
frederikstroem / proof.txt
Last active March 23, 2022 20:47
Session ID proof
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
Session ID: 05370a12bfe51c546b06bbc5dc131bfd091aeaf02bdfd5d9d4f8784f495522dc49
-----BEGIN PGP SIGNATURE-----
iHUEARYKAB0WIQRuImp4wxgx4e3uWqPaQi3qJfhRSAUCYjuF5QAKCRDaQi3qJfhR
SJFOAP9LEFIM2mye+d/v+J64gI+XZ06UR9aT12KJC1nv73UxCAD+J9WZHfP2L/uq
Pm10NZgsVrwcbB4pmU/eVWxSfhj4MAE=
=BH+I
@frederikstroem
frederikstroem / docker-compose.yml
Last active December 31, 2023 15:41
Run tensorflow/tensorflow:latest-gpu-jupyter docker image on localhost without having to authenticate. Useful if you SSH into your machine etc.
version: "3.9"
# https://www.tensorflow.org/install/docker
services:
tensorflow:
image: tensorflow/tensorflow:latest-gpu-jupyter # https://hub.docker.com/r/tensorflow/tensorflow/
container_name: tensorflow
hostname: tensorflow
# https://github.com/tensorflow/tensorflow/blob/master/tensorflow/tools/dockerfiles/dockerfiles/gpu-jupyter.Dockerfile
# https://stackoverflow.com/a/60327026
-----BEGIN PGP PUBLIC KEY BLOCK-----
mDMEYcKXfhYJKwYBBAHaRw8BAQdAYYr1A3SfO/3KrCcRH1B9Auug0f2c7i7Eyik+
iNrpsOm0SEZyZWRlcmlrIEhvbG0gU3Ryw7htIChodHRwczovL2ZyZWRlcmlrc3Ry
b2VtLmNvbSkgPGZyZWRlcmlrc3Ryb2VtQHBtLm1lPoiOBBMWCgA2FiEEnqbIZhZa
OoYIvjVo6i3CfoeklPIFAmHCl34CGwEECwkIBwQVCgkIBRYCAwEAAh4BAheAAAoJ
EOotwn6HpJTyBPgA/3OwTUAZCpAb6lpZfEg4epRYU25iO2xLH2FLKcqBJ36YAQDE
NFBjP3uXhi8A9/MJ8ruD5Y7x7z0ACBDFfZvFjzsDCLgzBGHDME4WCSsGAQQB2kcP
AQEHQFLcJG5N6cP2nHHLtSECwIHL9fo3rbq5a6J+ZNV76UXxiO8EGBYKACAWIQSe
pshmFlo6hgi+NWjqLcJ+h6SU8gUCYcMwTgIbAgCBCRDqLcJ+h6SU8nYgBBkWCgAd
@frederikstroem
frederikstroem / .bash_aliases
Created January 28, 2020 20:43
A sleppy alias using redshift
alias night="redshift -v -P -O 2000K"
alias night1500="redshift -v -P -O 1500K"
alias night2500="redshift -v -P -O 2500K"
alias night3000="redshift -v -P -O 3000K"
alias night3500="redshift -v -P -O 3500K"
alias night4000="redshift -v -P -O 4000K"
alias night4500="redshift -v -P -O 4500K"
alias nightOff="redshift -v -x"