Files
t0txt/misc/show_random.py
T

29 lines
830 B
Python
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import shelve
import random
WHITELIST = ['t0.vc', 'tanner', 'protospace', 'seed combinations', 'tcoins in circulation', 'pokemon trade', 'pokemon battle', 'unique in collection', '%) left.', 'telethon', 'datetime', ' +0000', 'print(', 'console.log', 'systemd', '-Iinclude', 'BOOT_IMAGE', '#endif', '/bin/bash', 'python3.', 'stdio.h']
db = shelve.open('data/t0txt')
keys = list(db.keys())
while True:
while True:
note_id = random.choice(keys)
note = db[note_id]
for good_word in WHITELIST:
if good_word in note.lower():
break
else: #for
break
print(note)
num_http = note.count('http')
num_line = note.count('\n')
print('num http:', num_http, 'lines:', num_line, 'ratio:', num_http / num_line if num_line else 'inf')
input()