dotfiles/.local/bin/scripts/netkeeper

16 lines
577 B
Plaintext
Raw Normal View History

2022-05-19 09:42:01 +00:00
#!/bin/sh -e
# Keeps the Internet at bay
2022-09-03 18:07:05 +00:00
if test -e "$JOURNAL"; then
2023-03-13 14:36:09 +00:00
# TODO ask previous
echo "What do you want to do? Check your journal!" >&2
2023-03-13 14:36:09 +00:00
mins=${1:-10}
while test $(echo "$intention" | wc -c) -lt $mins
2022-09-03 18:07:05 +00:00
do read intention
done
jrnl intentions "$intention"
sudo nft flush chain inet filter outall
2023-03-13 14:36:09 +00:00
sudo nft add rule inet filter outall meta hour "$(date +%H:%M)"-"$(date +%H:%M --date="${mins}min")" accept
2022-09-03 18:07:05 +00:00
#expr \( "$1" \> 40 \) \* 10 \| "$1"
2023-03-13 14:36:09 +00:00
apprise $(pass service/apprise/intentions | head -1) -t "janeks intention for ${mins} min" -b "$intention"
2022-09-03 18:07:05 +00:00
fi