Skip to content

Instantly share code, notes, and snippets.

@Trumeet
Last active October 28, 2019 01:38
Show Gist options
  • Save Trumeet/53159d1f45e27bec091978da57132d23 to your computer and use it in GitHub Desktop.
Save Trumeet/53159d1f45e27bec091978da57132d23 to your computer and use it in GitHub Desktop.
Reinstall OS in 5 seconds XDD
#!/bin/bash
# License: WTFPL
# References vary.
# Usage: curl -fsSL https://gist.github.com/Trumeet/53159d1f45e27bec091978da57132d23/raw -o - | sh -
trap '' SIGINT
center() {
termwidth="$(tput cols)"
padding="$(printf '%0.1s' ={1..500})"
printf '\e[44;37;1m%*.*s %s %*.*s\e[0m\n' 0 "$(((termwidth-2-${#1})/2))" "$padding" "$1" 0 "$(((termwidth-1-${#1})/2))" "$padding"
}
COLUMNS=$(tput cols)
sudo printf %b '\e[44m' '\e[8]' '\e[H\e[J'
center "Working on reinstalling the system"
center "Do not turn off your computer"
sleep 5
printf %b '\e[44m' '\e[8]' '\e[H\e[J'
center "Windows needs to restart to continue"
trap SIGINT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment