Skip to content

Instantly share code, notes, and snippets.

@officialcjunior
Created May 31, 2020 13:36
Show Gist options
  • Save officialcjunior/b1e065a8975356945604f3ab5e432df7 to your computer and use it in GitHub Desktop.
Save officialcjunior/b1e065a8975356945604f3ab5e432df7 to your computer and use it in GitHub Desktop.
shitposter.py posts a shitpost on Mastodon.
# shitposter.py
# Requirements : Toot https://github.com/ihabunek/toot and a Unix-like system
import urllib.request
import random
import subprocess
word_url = "http://svnweb.freebsd.org/csrg/share/dict/words?view=co&content-type=text/plain"
response = urllib.request.urlopen(word_url)
long_txt = response.read().decode()
words_online = long_txt.splitlines()
words_local = open('/etc/dictionaries-common/words').readlines()
toot = ''
for i in range (random.randint(0,15)):
for j in range (random.randint(0,6)):
if j%2==0:
toot += random.choice(words_online)
else:
toot += random.choice(words_local)
toot += ' '
toot=toot.replace('\n', ' ')
subprocess.call('toot post "{post}"'.format(post=toot), shell=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment