Skip to content

Instantly share code, notes, and snippets.

@LandonPowell
Last active May 31, 2017 04:04
Show Gist options
  • Save LandonPowell/23a0f65d7ef6002512f341dfe7749f8a to your computer and use it in GitHub Desktop.
Save LandonPowell/23a0f65d7ef6002512f341dfe7749f8a to your computer and use it in GitHub Desktop.
Basically I made hackertyper.net but now you can run it in a terminal with whatever file you want and look even more hacker than usual.
import curses
import curses.ascii
from sys import argv
def main(screen):
global termsize
# Startup.
screen.clear()
curses.start_color()
curses.use_default_colors()
termsize = [curses.LINES, curses.COLS] # Curses uses [Y,X] and not [X,Y].
window = curses.newwin(termsize[0], termsize[1], 0,0)
# Open File.
if len(argv) >= 2:
file = open(argv[1], 'r')
text = file.read()
file . close()
else:
raise(Exception( "Requires file." ))
index = 0
currentText = [""]
# Handle input
while True:
if index >= len(text):
index = 0
screen.getkey()
try:
screen.addstr(text[index])
if "\n" in text[index]:
currentText.append("")
else:
currentText[-1] += text[index]
index += 1
except curses.error:
screen.clear()
currentText = currentText[len(currentText) // 2:]
screen.addstr("\n".join(currentText))
curses.wrapper(main)
@LandonPowell
Copy link
Author

LandonPowell commented May 31, 2017

Usage?

python HackerTyper.py WHATEVERFILEHERE.TXT

Get the hackertyper.net kernel.txt file here - http://hackertyper.net/kernel.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment