feat: init

This commit is contained in:
Moritz Böhme 2025-09-01 18:23:24 +02:00
commit fa84593dee
No known key found for this signature in database
GPG key ID: 970C6E89EB0547A9

40
tickets.sh Executable file
View file

@ -0,0 +1,40 @@
#!/usr/bin/env bash
# Open URLs to buy Tickets for the colosseo in one week
# Usage: ./tickets.sh [TIME]
# Opens the URLs to buy tickets in one week.
#
# Optional TIME controls the time to look for.
# Examples: ./tickets.sh "8:15 next week"
url_base="https://ticketing.colosseo.it/en/eventi/una-notte-al-colosseo/"
get_next_quarter_hour() {
# Get the current Unix timestamp
local current_timestamp=$(date +%s --date "${1:-next week}")
# Round up to the nearest quarter hour
local rounded_up_timestamp=$((current_timestamp + 900 - ((current_timestamp-1) % 900)))
date +"%Y-%m-%dT%I%%3A%M%%3A00Z" --date="@$rounded_up_timestamp"
}
construct_url() {
echo "${url_base}?t=$1#slotpicker"
}
open_in_firefox_incognito() {
firefox --private-window "$1"
}
datetime="$(get_next_quarter_hour "$1")"
url="$(construct_url "$datetime")"
if command -v firefox >/dev/null 2>&1; then
firefox "$url"
firefox --private-window "$url"
fi
if command -v chromium >/dev/null 2>&1; then
chromium "$url" >/dev/null 2>&1 &
chromium --incognito "$url" >/dev/null 2>&1 &
fi