1
0
Fork 0

Add dingdingding

This commit is contained in:
Malte Brandy 2021-07-26 11:55:22 +02:00
parent b552ca6414
commit c1ecd8f7f0
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
2 changed files with 35 additions and 0 deletions

View file

@ -181,6 +181,9 @@
pkgs.writeShellScriptBin "print-ssh-pw"
"pass show eu/m-0/${config.m-0.hostName}.m-0.eu/ssh-key"
)
(
pkgs.writeShellScriptBin "dingdingding" (builtins.readFile ./signal.sh)
)
];
sessionVariables = {
PATH = "$HOME/.nix-profile/bin:$PATH";

32
home-manager/roles/signal.sh Executable file
View file

@ -0,0 +1,32 @@
#!/usr/bin/env bash
x=$1
while true; do
if [[ "$x" == "0" ]]; then
exit
fi
if [[ "$x" != "" ]]; then
echo "$x rings left"
x=$(( x - 1 ))
fi
current_seconds=$(date +%S)
current_minute=$(date +%M)
if (($current_minute < 30)); then
echo "Next ring at half hour."
sleep_seconds=$(( (29 - $current_minute)*60+ (60 - $current_seconds)))
else
echo "Next ring at full hour."
sleep_seconds=$(( (59 - $current_minute)*60+ (60 - $current_seconds)))
fi
echo "Sleeping for $sleep_seconds seconds."
sleep $sleep_seconds
echo "Ringing Bell"
mpv ./bell.opus
done