Skip to content

Instantly share code, notes, and snippets.

@tikikun
Forked from 23maverick23/randPassGen.py
Created September 2, 2018 12:08
Show Gist options
  • Select an option

  • Save tikikun/75f36bbdc18a3f6ae2eb7ea5ceabdc8e to your computer and use it in GitHub Desktop.

Select an option

Save tikikun/75f36bbdc18a3f6ae2eb7ea5ceabdc8e to your computer and use it in GitHub Desktop.

Revisions

  1. tikikun revised this gist Sep 2, 2018. 1 changed file with 19 additions and 0 deletions.
    19 changes: 19 additions & 0 deletions randPassGen.py
    Original file line number Diff line number Diff line change
    @@ -15,3 +15,22 @@ def password_generator(size=8, chars=string.ascii_letters + string.digits):
    Source: http://stackoverflow.com/a/2257449
    """
    return ''.join(random.choice(chars) for i in range(size))

    def multi_string_ran(size=8, num=3):
    """
    Make sure that you create multiple strings but not repeated
    I know this is one in million and trillion but that odd bug me
    Thank you
    """
    results = []
    counter = 0
    while counter < num:
    ran_str = password_generator(size)
    if ran_str not in results:
    results.append(ran_str)
    counter += 1
    else:
    continue
    return results
  2. @23maverick23 23maverick23 renamed this gist Sep 18, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. @23maverick23 23maverick23 created this gist Nov 22, 2012.
    17 changes: 17 additions & 0 deletions Python: Random password generator
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    #!/usr/bin/env python

    import string
    import random

    def password_generator(size=8, chars=string.ascii_letters + string.digits):
    """
    Returns a string of random characters, useful in generating temporary
    passwords for automated password resets.
    size: default=8; override to provide smaller/larger passwords
    chars: default=A-Za-z0-9; override to provide more/less diversity
    Credit: Ignacio Vasquez-Abrams
    Source: http://stackoverflow.com/a/2257449
    """
    return ''.join(random.choice(chars) for i in range(size))