Skip to content

Instantly share code, notes, and snippets.

View epilys's full-sized avatar

Manos Pitsidianakis epilys

View GitHub Profile
@epilys
epilys / list_fileinto.sieve
Created February 23, 2024 16:27
sieve filter to create new List mailboxes according to List-ID value
#require ["fileinto", "mailbox", "variables", "vnd.dovecot.debug", "regex"];
require ["fileinto", "mailbox", "variables", "regex", "vnd.dovecot.execute"];
if not exists "X-GitHub-Recipient" {
if header :regex :comparator "i;octet" "list-id" "(.*)" {
#set :lower "listid_raw" "${1}";
execute :input "${1}" :output "listid" "sanitize_name.sh";
fileinto :create "INBOX.Lists.${listid}";
stop;
@epilys
epilys / status_email_debian@.service
Created January 31, 2024 07:20
systemd service to send you an email on failure
[Unit]
Description=status email for %i to user
[Service]
Type=oneshot
ExecStart=/usr/local/bin/systemd-email user@example.com %i
User=debian
Group=systemd-journal
## Example usage:
@epilys
epilys / port-tunnel.service
Created January 31, 2024 07:15
systemd service to port forward service
[Unit]
Description=Setup a secure tunnel to a local API port on another server named my-other-server in ssh config
After=network-online.target
[Service]
SyslogIdentifier="my-api-tunnel"
ExecStartPre=/bin/sh -c "/usr/bin/ssh -O exit my-other-service; true"
ExecStop=/bin/sh -c "/usr/bin/ssh -O exit my-other-service; true"
ExecStart=/usr/bin/ssh -NT -o LogLevel=ERROR -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -L 8000:localhost:8000 my-other-service
#!python3
# Copyright (c) 2024 Manos Pitsidianakis <manos@pitsidianak.is>
# Licensed under the EUPL-1.2-or-later.
#
# You may obtain a copy of the Licence at:
# https://joinup.ec.europa.eu/software/page/eupl
#
# SPDX-License-Identifier: EUPL-1.2

$argon2id$v=19$m=64,t=512,p=2$xXhX0KQjCbIlev+gckWSYg$kNbnVzlIpCPwxlGME9r1sA

@epilys
epilys / LICENCE
Last active February 17, 2024 11:03
mastodon follower tracking (please do not use for unhealthy social media obsession reasons, it's for curiosity/fun only)
EUROPEAN UNION PUBLIC LICENCE v. 1.2
EUPL © the European Union 2007, 2016
This European Union Public Licence (the ‘EUPL’) applies to the Work (as defined
below) which is provided under the terms of this Licence. Any use of the Work,
other than as authorised under this Licence is prohibited (to the extent such
use is covered by a right of the copyright holder of the Work).
The Work is provided under the terms of this Licence when the Licensor (as
defined below) has placed the following notice immediately following the
#!/bin/sh
check_onwers() {
CRATE_NAME="$1"
echo "INFO: querying https://crates.io/api/v1/crates/${CRATE_NAME}/owners"
OWNERS_REPLY=$(curl --silent "https://crates.io/api/v1/crates/${CRATE_NAME}/owners")
echo "INFO: API reply was ${OWNERS_REPLY}"
@epilys
epilys / get_vim-plugged_descriptions.sh
Created July 17, 2023 10:58
Get descriptions of vim-plugged plugins from their github repo
#!/bin/zsh
for rep in $(cat ~/.config/nvim/init.vim|grep "^Plug '[^~:]\+" | sed "s/^Plug '\([^'\]*\)[/]\([^']\+\)'.*$/\1\/\2/p" | sort -d | uniq); do
echo -n "$rep " &&
curl --silent -L \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/$rep | jq ".description";
done
@epilys
epilys / dbg_macro.c
Created June 20, 2023 05:44
dbg_macro.c
#define DBG(val) ({ typeof(val) _val = (val); fprintf(stderr, "[%s:%d] %s = ", __FILE__, __LINE__, #val); __builtin_dump_struct(&_val, fprintf, stderr); _val; })
@epilys
epilys / Document.md
Last active March 23, 2023 14:12
Compile markdown files with pandoc in shebang. Excute .md file as a script: "./Document.md". You might need to set the executable bit with chmod u+x Document.md
#!/usr/bin/env -S bash -c 'pandoc --from markdown -V links-as-notes -V boxlinks -V pagestyle:empty --pdf-engine xelatex -V mainfont:'FiraSans-Medium' -V geometry:a6paper -t pdf -o "$(basename ${0} md)pdf" <(tail -n +2 "${0}")'
Dear reader,
This is a letter addressed to you, written in Markdown.
Author Name