mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat(i3status-rust): lil jq tweaking
This commit is contained in:
29
.bin/anki-poem.sh
Executable file
29
.bin/anki-poem.sh
Executable file
@@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
file="${1?please supply a poetry file}"
|
||||||
|
[ -f "$file" ] || {
|
||||||
|
echo "'$file' is no file"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
poem="$(mktemp)"
|
||||||
|
clean () {
|
||||||
|
rm "$poem"
|
||||||
|
}
|
||||||
|
trap clean EXIT
|
||||||
|
sed '/^$/d' "$file" > "$poem"
|
||||||
|
|
||||||
|
htmlize() {
|
||||||
|
awk 'ORS="<br/>"' \
|
||||||
|
| head -c -5 # remove final <br/> characters
|
||||||
|
}
|
||||||
|
|
||||||
|
for line_number in $(seq 1 "$(wc -l "$poem" | cut -d' ' -f1)"); do
|
||||||
|
if [ "$line_number" -gt 3 ] && [ "$line_number" -gt 1 ]; then
|
||||||
|
sed -n "$((line_number - 3)),$((line_number - 1))p" "$poem"
|
||||||
|
else
|
||||||
|
sed -n "1,$((line_number - 1))p" "$poem"
|
||||||
|
fi | htmlize
|
||||||
|
printf '\t'
|
||||||
|
sed -n "${line_number},+1p" "$poem" | htmlize
|
||||||
|
printf '\n'
|
||||||
|
done
|
||||||
26
.bin/watson2fdf.sh
Executable file
26
.bin/watson2fdf.sh
Executable file
@@ -0,0 +1,26 @@
|
|||||||
|
project=Filli
|
||||||
|
year=2022
|
||||||
|
|
||||||
|
for month in Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec; do
|
||||||
|
from="$(date +%F -d "$month 1, $year")"
|
||||||
|
to="$(date +%F -d "$month 1, $year + 1 month")"
|
||||||
|
watson report --json --from "$from" --to "$to" --project "$project"
|
||||||
|
done | jq --slurp '
|
||||||
|
def in_array($arr):
|
||||||
|
. as $value | any($arr[]; . == $value);
|
||||||
|
|
||||||
|
map(
|
||||||
|
["engadin-app","fysiweb","val-muestair","mia-engiadina","ol"] as $official_projects
|
||||||
|
| (.timespan.from | .[0:7]) as $timespan
|
||||||
|
| .projects | .[0]
|
||||||
|
| .time as $total_time
|
||||||
|
| .tags
|
||||||
|
| select(. != null)
|
||||||
|
| map(select(.name | in_array($official_projects)))
|
||||||
|
| (map(.time)|add) as $official_time
|
||||||
|
| map({key:.name, value:.time}) | from_entries
|
||||||
|
| .other |= ($total_time - $official_time)
|
||||||
|
| map_values(. / (60*60) | ceil)
|
||||||
|
| .month |= $timespan
|
||||||
|
)
|
||||||
|
'
|
||||||
@@ -211,12 +211,12 @@ in {
|
|||||||
| ${pkgs.coreutils}/bin/head -1 \
|
| ${pkgs.coreutils}/bin/head -1 \
|
||||||
| ${pkgs.coreutils}/bin/date --date="$(cat)" +%s
|
| ${pkgs.coreutils}/bin/date --date="$(cat)" +%s
|
||||||
)" \
|
)" \
|
||||||
'($nextEvent - now) as $deltaT
|
'{
|
||||||
| {
|
|
||||||
text: $now,
|
text: $now,
|
||||||
icon: "time",
|
icon: "time",
|
||||||
state: (
|
state: (
|
||||||
if $deltaT < (5 * 60) then
|
($nextEvent - now) as $deltaT
|
||||||
|
| if $deltaT < (5 * 60) then
|
||||||
"Critical"
|
"Critical"
|
||||||
elif $deltaT < (15 * 60) then
|
elif $deltaT < (15 * 60) then
|
||||||
"Warning"
|
"Warning"
|
||||||
|
|||||||
Reference in New Issue
Block a user