Skip to content

Instantly share code, notes, and snippets.

@alanduan
Created April 11, 2016 23:06
Show Gist options
  • Save alanduan/257879e02d29debc0306eeeecbf90681 to your computer and use it in GitHub Desktop.
Save alanduan/257879e02d29debc0306eeeecbf90681 to your computer and use it in GitHub Desktop.
import time
from random import randint
import curses
from console import ConsoleDisplay
if __name__ == '__main__':
rows, cols = (25, 80)
def func(stdscr, rows, cols):
console = ConsoleDisplay(stdscr, rows, cols)
while True:
vram = [chr(randint(0x20, 0x7f)) for i in xrange(rows * cols)]
console.refresh(vram)
time.sleep(0.1)
#curses.wrapper(func)
#import sys; sys.exit(1)
import mmap
with open('console.ram', 'r+b') as f:
m = mmap.mmap(f.fileno(), rows * cols)
while True:
msg = raw_input()
m.write(msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment