Skip to content

Instantly share code, notes, and snippets.

@crock
Last active February 15, 2018 01:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save crock/9c6953d1a399a7e487514cd6f114253b to your computer and use it in GitHub Desktop.
Save crock/9c6953d1a399a7e487514cd6f114253b to your computer and use it in GitHub Desktop.
My personal collection of utility functions for Python
import string
import random
class accorelib:
"""My personal collection of utility functions"""
def __init__(self):
print("accorelib initialized...")
def debug(self, message):
"""Prints out debug message to console
Arguments:
message {string} -- the debug message
"""
print("\n[DEBUG] %s\n" % message)
def hash(self, size=16, chars=string.ascii_uppercase + string.digits + string.ascii_lowercase):
"""Generate a strong, randomized string that could be used for a password
Keyword Arguments:
size {integer} -- Length of string (default: {16})
chars {list} -- what characters to include (default: {string})
"""
return ''.join(random.choice(chars) for _ in range(size))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment