Skip to content

Instantly share code, notes, and snippets.

@james-see
Created January 12, 2015 18:39
Show Gist options
  • Save james-see/5329163e5981eafca150 to your computer and use it in GitHub Desktop.
Save james-see/5329163e5981eafca150 to your computer and use it in GitHub Desktop.
pycyplains.py
## PYCY
## A SIMPLE TOOL FOR SIMPLE CIPHER FOR EVERY DAY OF THE MONTH in plaintext
## set to work in pythonista
import string
import random, sys
import calendar
import datetime
import clipboard #pythonista app
# GLOBALS
alphalist = list(string.ascii_lowercase) # get list of a-z
alphastring = string.ascii_lowercase # get string of a-z
secureset = '@#$%^&*~!#'
now = datetime.datetime.now()
currentmonthdays = calendar.monthrange(now.year, now.month)[1] # days in current month
thismonthandyear = now.strftime("%B %Y")
i = 0 # has to be zero to count loop correctly
# FUNCTIONS
def id_generator(size=26, chars=alphastring + string.digits + secureset ):
return ''.join(random.choice(chars) for _ in range(size))
# MAIN PROG
# prints current month and then codes for each day in month
plains = thismonthandyear + "\n"
plains = plains + alphastring + "\n"
while i < currentmonthdays:
randomized = random.sample(alphastring + string.digits + secureset,len(alphastring))
randomized = ''.join(randomized)
plains = plains + '\n' + randomized
i = i + 1
print plains
clipboard.set(plains) # for pythonista
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment