Skip to content

Instantly share code, notes, and snippets.

@erkiesken
Created February 5, 2021 22:57
Show Gist options
  • Save erkiesken/603b05912da3ae4960a4058777368c06 to your computer and use it in GitHub Desktop.
Save erkiesken/603b05912da3ae4960a4058777368c06 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# <bitbar.title>UTC and local timezone</bitbar.title>
# <bitbar.version>v1.0.0</bitbar.version>
# <bitbar.author>Erki Esken</bitbar.author>
# <bitbar.author.github>erkiesken</bitbar.author.github>
# <bitbar.desc>Show the current time in local and UTC timezone.</bitbar.desc>
TIME_UTC=$(TZ="UTC" date "+%H:%M")
TIME_LOCAL=$(date "+%H:%M")
TIME_EPOCH=$(date "+%s")
TIME_DATE=$(date "+%A, %m/%d")
TIME_DATE_ISO=$(TZ="UTC" date "+%Y-%m-%dT%H:%M:00Z")
TIME_DATE_MONTH=$(date "+%m")
TIME_DATE_DAY=$(date "+%d")
nice_numbers() {
local s=$1
s="${s//0/𝟢}"
s="${s//1/𝟷}"
s="${s//2/𝟸}"
s="${s//3/𝟹}"
s="${s//4/𝟺}"
s="${s//5/𝟻}"
s="${s//6/𝟼}"
s="${s//7/𝟽}"
s="${s//8/𝟾}"
s="${s//9/𝟿}"
echo "${s}"
}
superscript_numbers() {
local s=$1
s="${s//0/⁰}"
s="${s//1/ΒΉ}"
s="${s//2/Β²}"
s="${s//3/Β³}"
s="${s//4/⁴}"
s="${s//5/⁡}"
s="${s//6/⁢}"
s="${s//7/⁷}"
s="${s//8/⁸}"
s="${s//9/⁹}"
echo "${s}"
}
subscript_numbers() {
local s=$1
s="${s//0/β‚€}"
s="${s//1/₁}"
s="${s//2/β‚‚}"
s="${s//3/₃}"
s="${s//4/β‚„}"
s="${s//5/β‚…}"
s="${s//6/₆}"
s="${s//7/₇}"
s="${s//8/β‚ˆ}"
s="${s//9/₉}"
echo "${s}"
}
SHORT_DATE="$(superscript_numbers "${TIME_DATE_MONTH}")⁄$(subscript_numbers "${TIME_DATE_DAY}")"
nice_numbers "${SHORT_DATE} πŸ…›β€‰${TIME_LOCAL} πŸ…€β€‰${TIME_UTC}"
echo "---"
echo "${TIME_DATE} | color=#999999"
echo "Unix: ${TIME_EPOCH} | color=#999999 bash='~/Tools/pbcopy.sh' param1='${TIME_EPOCH}' terminal=false refresh=false"
echo "${TIME_DATE_ISO}| color=#999999 bash='~/Tools/pbcopy.sh' param1='${TIME_DATE_ISO}' terminal=false refresh=false"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment