Last active
September 28, 2019 23:23
-
-
Save heimskr/3811a24160e6674809774630c4c722ac to your computer and use it in GitHub Desktop.
If your client is so terrible that decslrm.sh crashes it, run this and count the number of times you press enter before the crash to discover the culprit.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
enable_hmargins() { echo -ne "\x1b[?69h"; } | |
disable_hmargins() { echo -ne "\x1b[?69l"; } | |
hmargins() { echo -ne "\x1b[$1;$2s"; } # left, right | |
vmargins() { echo -ne "\x1b[$1;$2r"; } # top, bottom | |
origin_on() { echo -ne "\x1b[?6h"; } | |
origin_off() { echo -ne "\x1b[?6l"; } | |
scroll_up() { echo -ne "\x1b[$1S"; } | |
scroll_down() { echo -ne "\x1b[$1T"; } | |
blank() { scroll_up 999; } | |
bg() { echo -ne "\x1b[4$1m"; } | |
rows() { tput lines; } | |
cols() { tput cols; } | |
read | |
enable_hmargins # 1 read | |
read | |
hmargins 1 $((`cols`/2)) # 2 reads | |
read | |
vmargins 1 $((`rows`/2)) # 3 reads | |
read | |
origin_on # 4 reads | |
read | |
bg 1 # 5 reads | |
read | |
blank # 6 reads | |
read | |
hmargins $((`cols`/2)) `cols` # 7 reads | |
read | |
bg 2 # 8 reads | |
read | |
blank # 9 reads | |
read | |
hmargins 1 $((`cols`/2)) # 10 reads | |
read | |
vmargins $((`rows`/2)) `rows` # 11 reads | |
read | |
bg 4 # 12 reads | |
read | |
blank # 13 reads | |
read | |
hmargins $((`cols`/2)) `cols` # 14 reads | |
read | |
bg 3 # 15 reads | |
read | |
blank # 16 reads | |
read | |
bg 1 | |
echo -n "Press enter to escape this mess." | |
read | |
disable_hmargins | |
origin_off | |
clear |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment