Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Rolotext: like a rolodex, but for a text file. Spinnnnn. Works with xscreensaver.
#!/usr/bin/env python3
# Placed under WTFPL. Get out of my face.
# usage:
# <textfile>
# Reads a file, starting from a random point in the file.
# Simulates a dilout connection as well, by having a varied
# character printout.
# Eats a little entropy.
import sys
import random
import time
if len(sys.argv) != 2:
print("I take one argument.")
# Read the input file.
ff = open(sys.argv[1], "r")
lines = ff.readlines()
now = random.randint(0, len(lines)-1)
end = now-1
if(end < 0 ):
end = 0
now = 1
while now != end:
line = lines[now]
now = ( now + 1 ) % (len(lines))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.