Skip to content

Instantly share code, notes, and snippets.

@jordanbrauer jordanbrauer/thanos.sh
Last active Jul 27, 2019

Embed
What would you like to do?
perfectly balanced, as all things should be
#!/usr/bin/env bash
echo 'ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBgYC4tLTo6Ojo6LS0tLS5gYCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgYC0tLy8vKysrKysrKysvLy8vLzo6Oi0uYCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBgLS8rKysrKysrLysrKysrKysrLy8vLy8vLy8vOi5gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuLytvKytvb29vKy8vKysrKy8rLy8vKysvLy8vLzo6OjotYCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBgL29zc3Nzc29vb28rKysrKysrLy8vLy8vKy8vOjo6Ojo6OjotLmAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9zc3Nzc3Nzb28rKysrKysrKysvLy8vLy8vOi86Ojo6Ojo6OjotLWAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICA6c3l5c3Nzc3NvKysrKysvLysrKy8vLy8vOjo6Oi0tLTotLS0tOjotLWAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnN5eXNzb3Nzb29vKysrKy8vLy8vLy8vOjo6LS0tLS0tLS0tLS06Ojo6LSAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICBveXl5eXlzb29vb28rLy8vLy8vLy8vLzo6Oi0tLS0uLi4tLS06Ojo6Ojo6LiAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLnl5eWhoaHlzb29zcysrLysvLy8vLy8vLzo6LS0tLS0tLTo6Ojo6Ojo6OjotICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAraGhoaHl5eXNvc3NvbysrKysrKy8rKysvLzotLS0tLS0tOi06Ojo6Oi8vOjpgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIHloaGhoeXl5eXlzc3Nvb29vbysrLy8rKysvOjo6Ojo6Oi0tOjo6Oi86Ly8vOi4gICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICBgaGhoaHl5eXl5eXNvb29vb29vb29vKytvKysvOjo6LTo6Ojo6Ojo6LzovLy86LiAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgLS86LS1oaGhoeXl5c3Nzc29vb29vb29vKysrKysrLy86Oi0tLS06Oi06LTovLy8vLzotICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgIDpkZGhoaGhoaGhoeXl5c3NvbysrKysrKysrKysrKysrLy86Ojo6OjotLS0tOi8vLy8vLzogICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgK21tZGRoaGhoaGh5aHNzc3Nvbysrb28rK28rb29vKysrLy86Ojo6LS0tLS06Ly8vOi8vLzo6OjouICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICA6ZGhoZHloaGhoaGhoaHl5cysrKy8rbysvK28rK3MrKy8rKy86LS0tLS0tOjo6Ly86LzovOi8reXNgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgIC1oaG1keXl5eWhoaGRkZGRoeXNvKysvKy9vbysvaHMrOjo6Ojo6Ly8rKysrKy8vLy8vLy8rLy9zcyAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgYGhoZGh5eXloaGhoZG1kZGRkZGRkaHl5eXlvbytvaHlzb3N5eXNzeXNvb28rLy8vLy8vK2RkeSsvICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgLXloaGhoaGhoeWhoaGhkbU5OTk5OTm1kcysvOi95aGROTk5NTU1NbWgrKysvLy8vLy8vaHNzKy4gICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgL2hoaGhkeXl5eXl5aGh5c3Nzc2hkaGhvOi0tOi8reXlzbysrKy86Lzo6Ojo6Ly8vLytzLy8tICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAueWhoaGhoaGh5eXloaHlzb28rc3l5eW86Oi06Ojovb28rLzovLy86Oi86LTovLy8vLy8vLiAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICA6c2hoaGhoaHlzc3l5eXNzb29vc3l5cy86LTovLzotLS86Ojo6Ojo6Ojo6Oi8rLy8vL2AgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAvaGhkZGRoaHlzb3Nzc3NzeWhzeXlzKysvOi8vbys6LS0tLTo6OjovLy8vLysvLy8uICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIG9oaGRkZGRoeXlvb3NzaGRtaGRtZGR5eXNvc3MraHMrLzo6Ojo6OjovLy8vLysvYCAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgeWhkZGRkZGRoeXl5aGRtZGh5eWhoaGh5Ky8rKy8vc2hzKy8vLzo6Ly8rKysrLy8gICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgIGBoaGRkZGRkZGRkaGhtZGhoaHl5eXNvc3krLy8vLy8vK2h5bysvLy8vLysrbysvLyAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIHlkZGhkaGhoZGRkbWRoaGh5eXlzKy9vcys6Ly8vLy8vL3l5bysrKysrKytvKy8uICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgc2RoaGhoaGhoZGRoaGhoaHloaHlzKy8rbysrLy8vLy8rK3l5bytvKysrK3MrL2AgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICBvaGhoZGhoaGhkZGhkZGRkZGRkZGRkaHl5eXl5c28rKy8rK2hzK28rbysrbysvYCAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIC5oZGRkaGRkZG1kZGRkaGh5c3Nvb3NzbysrLytvb3Nzc3Nvb2grb29vKytvKy0gICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgIC9oZGRoZGRkbW1kZGRkZGRoZHlzb29zKysrKy8rLysrb3NvaCsrbytvK286ICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgIC55ZGRkZG1tZGRtZGRkbWRtbWRobWR5eWR5eXNzeW8rc295KytvK28rOiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC1oZGRkZGRkZG1kbWRtZGhtZGhtZHloZHlkc3NoK3krc3lvKysvKy0gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC15ZGRoZGhkZGRkZG1kaG1oeWRob2h5c2hzc2Rvcysvc28vLy1gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIC5zaGRkZGRkZGhoZGh5ZHlzaHlveXNzc295eXMrcytvcy8uICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGAveWRkZGRtaGRoeWhoeXlkeW9zc295K3kraCtzb28rYCAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAuc2htbW1kbWRoZGR5eWRoc2h5b2hveXNzb28rLWAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgLXN5ZGRtZGRtZGhkbWh5ZGhzaHNoeXMrLWAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGAuL3Noc2hoaGhtZHltZHN5K3M6LWAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGBgYC4tLjovLTovLWAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAK' | base64 --decode
spinner() {
local proc="$1"
local message="$2"
local frames="⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏"
local delay="0.1"
tput civis # hide cursor
while kill -0 ${proc} 2>/dev/null; do
for frame in $frames; do
printf "\033[1;34m\033[s\033[u $frame \033[0m%s\r" "$message"
sleep $delay
done
done
wait $1
local code=$?
[[ $code -ne 0 ]] && local status="\033[38;5;124m⨉\033[0m" || local status="\033[38;5;28m✓\033[0m"
printf '\033[s\033[u%*s\033[u\033[0m\r' $((${#message}+3)) " " # return to normal
echo ' '$status' '$message
tput cnorm # restore cursor
return $code
}
infinitystones() {
printf ' Gathering infinity stones • • • • • •'
sleep $(( RANDOM % 3 + 1 )); printf "\r Gathering infinity stones";
printf ' \033[38;5;33m•\033[0m • • • • •'
sleep $(( RANDOM % 3 + 1 )); printf "\r Gathering infinity stones";
printf ' \033[38;5;33m•\033[0m \033[38;5;226m•\033[0m • • • •'
sleep $(( RANDOM % 3 + 1 )); printf "\r Gathering infinity stones";
printf ' \033[38;5;33m•\033[0m \033[38;5;226m•\033[0m \033[38;5;160m•\033[0m • • •'
sleep $(( RANDOM % 3 + 1 )); printf "\r Gathering infinity stones";
printf ' \033[38;5;33m•\033[0m \033[38;5;226m•\033[0m \033[38;5;160m•\033[0m \033[38;5;99m•\033[0m • •'
sleep $(( RANDOM % 3 + 1 )); printf "\r Gathering infinity stones";
printf ' \033[38;5;33m•\033[0m \033[38;5;226m•\033[0m \033[38;5;160m•\033[0m \033[38;5;99m•\033[0m \033[38;5;40m•\033[0m •'
sleep $(( RANDOM % 3 + 1 )); printf "\r ✓ Gathering infinity stones";
printf ' \033[38;5;33m•\033[0m \033[38;5;226m•\033[0m \033[38;5;160m•\033[0m \033[38;5;99m•\033[0m \033[38;5;40m•\033[0m \033[38;5;202m•\033[0m'
}
infinitystones &
spinner $!
sleep 2 &
spinner $! 'Loading stones into gauntlet ...'
$(sleep 3; exit $(( RANDOM%2 == 0 )) && code='1' || code='0') &
spinner $! 'Attempting server snap ...' && {
echo " \033[38;5;237m→ Successfully removed 50% of server contents\033[0m"
} || {
echo " \033[38;5;237m→ Avengers are pissing me off\033[0m"
}
echo '';
printf " \e[3mPerfectly balanced, as all things should be\e[0m\n"
printf " — \e[3mThanos\e[0m\n"
@jordanbrauer

This comment has been minimized.

Copy link
Owner Author

commented Jul 27, 2019

To use it from here:

sh -c "$(curl -sSL https://gist.githubusercontent.com/jordanbrauer/cc5c5305100620076cb0872c403878e3/raw/1451c7284fbf112d73f244de749bbe807a3dfa4f/thanos.sh)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.