1
0
mirror of https://github.com/kmein/niveum synced 2026-03-22 04:41:07 +01:00

6 Commits

8 changed files with 93 additions and 4 deletions

38
.bin/256color Executable file
View File

@@ -0,0 +1,38 @@
#! /bin/sh
set -euf
pl() {
for i in $(seq $1 $(expr $2 - 1)); do
printf '\e[38;5;%sm%03i\e[m ' $i $i
done
printf '\e[38;5;%sm%03i\e[m\n' $2 $2
}
p() {
printf '\e[38;5;%sm%03i\e[m ' $1 $1
}
pn() {
printf '\e[38;5;%sm%03i\e[m\n' $1 $1
}
p6x6() {
for i in $(seq 0 5); do
for j in $(seq 0 5); do
p $(expr $1 + $i + $j \* 6)
done
echo
done
}
pl 0 7
pl 8 15
p6x6 16
p6x6 52
p6x6 88
p6x6 124
p6x6 160
p6x6 196
pl 232 243
pl 244 255

View File

@@ -15,11 +15,11 @@ candyman() {
")"
}
[ $# -eq 2 ] || usage
[ $# -ge 2 ] || usage
case "$1" in
add-reddit|add-telegram|add-youtube|add-twitter|add-twitch)
candyman "$1" "$2"
candyman "$@"
;;
*) usage;;
esac

13
.bin/countdown Executable file
View File

@@ -0,0 +1,13 @@
#!/usr/bin/env -S awk -f
function z() {
getline < "/proc/uptime"
close("/proc/uptime")
return $0
}
BEGIN {
x = z()
while (1) {
y = z()
printf "%02d:%05.2f\r", (y - x) / 60, (y - x) % 60
}
}

23
.bin/pdf-ocr.sh Executable file
View File

@@ -0,0 +1,23 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p poppler_utils tesseract4
set -eu
pdf_path="$(realpath "$1")"
[ -f "$pdf_path" ] || {
echo "Usage: $0 FILE.pdf" >&2
exit 1
}
tmpdir="$(mktemp -d)"
trap 'rm -rf $tmpdir' EXIT
cd "$tmpdir"
pdftoppm -png "$pdf_path" pdf-ocr
for png in pdf-ocr*.png; do
tesseract "$png" "$png.txt" 2>/dev/null
done
cat pdf-ocr-*.txt

View File

@@ -21,7 +21,7 @@ in
telegram = {
token = lib.strings.fileContents <system-secrets/telegram/moodle-dl.token>;
chat_id = "18980945";
send_error_msg = true;
send_error_msg = false;
};
token = lib.strings.fileContents <system-secrets/moodle.token>;
moodle_domain = "moodle.hu-berlin.de";

View File

@@ -29,7 +29,7 @@ in {
krebs.fetchWallpaper = {
enable = true;
# unitConfig.ConditionPathExists = "!/var/run/ppp0.pid";
url = "http://prism.r/realwallpaper-krebs.png";
url = "http://prism.r/realwallpaper-krebs-stars.png"; # http://prism.r/realwallpaper-krebs.png"; # "http://prism.r/realwallpaper-krebs-stars-berlin.png";
};
services.xserver = {

View File

@@ -91,6 +91,18 @@ in {
units = "metric";
};
}
{
block = "custom";
interval = 60 * 60 * 12;
command =
let
area = "states"; # "districts";
code = "BE"; # "11007";
in pkgs.writers.writeDash "incidence" ''
printf "📈"
${pkgs.curl}/bin/curl -sSL https://api.corona-zahlen.org/${area}/${code} | ${pkgs.jq}/bin/jq -r '.data.${code}.weekIncidence | round'
'';
}
{
block = "custom";
interval = 30;

View File

@@ -12,3 +12,6 @@ in runCommand "worldradio.m3u" {} ''
| uniq \
> $out
''
# anthoer method for running a world radio using Icecast Directory
# curl http://dir.xiph.org/ | pup 'a[href^=http]:contains("Play") attr{href}'