Snippets

xchandan clinotify

Created by xchandan
import time

MAX_SIZE = 10
BUFFER = ["" for i in range(MAX_SIZE)]
I = 0

def print_buffer():
    global BUFFER
    print('\x1bc')
    print("\n".join(BUFFER))

def push_update(message):
    global BUFFER
    global I

    if I == MAX_SIZE:
        I = 0
    BUFFER[I] = message
    I += 1
    print_buffer()

for i in range(1, 200):
    push_update("Hello World %s" % i)
    time.sleep(1)

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.