Skip to content

Instantly share code, notes, and snippets.

@xentec
Last active August 23, 2023 10:20
Show Gist options
  • Save xentec/5a7392a0c5b744c81a28ffd269931359 to your computer and use it in GitHub Desktop.
Save xentec/5a7392a0c5b744c81a28ffd269931359 to your computer and use it in GitHub Desktop.
CLI mensa plan for OTH Regensburg. Requires Nushell to run.
#!/usr/bin/env nu
let now = (date now)
let week = ($now | format date '%V' | str trim -l -c '0')
let url = $"https://www.stwno.de/infomax/daten-extern/csv/HS-R-tag/($week).csv"
(
http get --raw $url |
decode "iso-8859-1" |
str replace -a "\n(\n|(;|\\())" "$2" | # fix bullshit
from csv -s ";" |
where datum == ($now | format date "%d.%m.%Y") |
update name {|row| $row.name | str replace '([^\(]+)\(.+\)' '$1' } |
select warengruppe name kennz stud bed
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment