Skip to content

Instantly share code, notes, and snippets.

@vgmoose
Created August 20, 2015 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vgmoose/b7b73caf13e75f014b4c to your computer and use it in GitHub Desktop.
Save vgmoose/b7b73caf13e75f014b4c to your computer and use it in GitHub Desktop.
outputs an exclamation point in the center of the terminal
# clear the screen
IO.write("\e[3;J\e[H\e[2J")
# get the height and width
h = elem(Integer.parse(elem(System.cmd("tput", ["lines"]),0)),0)
w = elem(Integer.parse(elem(System.cmd("tput", ["cols"]),0)),0)
# get the center of the screen
xmid = round(w/2)
ymid = round(h/2)
# display ! in middle
IO.write("\e[#{ymid};#{xmid}H!")
# move cursor to bottom right
IO.write("\e[#{h};#{w}H")
IO.gets ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment