Skip to content

Instantly share code, notes, and snippets.

@lifeparticle
Created July 30, 2022 12:13
Show Gist options
  • Save lifeparticle/af0b36c4d5699588b65a62fb0c8df2eb to your computer and use it in GitHub Desktop.
Save lifeparticle/af0b36c4d5699588b65a62fb0c8df2eb to your computer and use it in GitHub Desktop.
#!/bin/bash
# <bitbar.title>Sunrise and sunset time</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>S Mahbub-Uz Zaman</bitbar.author>
# <bitbar.author.github>lifeparticle</bitbar.author.github>
# <bitbar.desc>Sunrise and sunset time</bitbar.desc>
# <bitbar.image></bitbar.image>
# <bitbar.dependencies></bitbar.dependencies>
# <bitbar.abouturl></bitbar.abouturl>
city="Sydney+NSW+Australia"
echo "📷"
echo "---"
sr=$(curl -sS https://sunrise-sunset.org/search?location=${city} | grep -EOI "Sunrise time:" | head -1 | egrep -o '\d+\:\d+\:\d+.[A-Z]+')
echo "Sunrise : $sr | color=red"
ss=$(curl -sS https://sunrise-sunset.org/search?location=${city} | grep -EOI "Sunset time:" | head -1 | egrep -o '\d+\:\d+\:\d+.[A-Z]+')
echo "Sunset : $ss | color=cadetblue"
echo "---"
fl=$(curl -sS https://sunrise-sunset.org/search?location=${city} | grep -EOI "First light at" | head -1 | egrep -o '\d+\:\d+\:\d+.[A-Z]+')
echo "First light : $fl | color= red"
ll=$(curl -sS https://sunrise-sunset.org/search?location=${city} | grep -EOI "Last light at" | head -1 | egrep -o '\d+\:\d+\:\d+.[A-Z]+')
echo "Last light : $ll | color=cadetblue"
echo "---"
echo "website | color=purple href=https://sunrise-sunset.org/search?location=Sydney+NSW%2C+Australia"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment