256 Kilobytes

Answers in Scripting and Automation | By August R. Garcia


252 views, 1 RAM, and 0 comments

Tags: Python, BASH, Password Generation, Correct Horse Battery Staple

Profile Photo - August R. GarciaAugust R. GarciaLARPing as a Sysadmi...Portland, ORSite Owner


Code for Correct Horse Battery Staple

Correct Horse Battery Staple in Python

def correct_horse_battery_staple():
        # Opens a newline-separated list of words that is generally included by default in Unix/Linux distributions
        # See https://gist.github.com/wchargin/8927565
        with open("/usr/share/dict/words") as f:
                lines = f.readlines()

                # Get four random lines and put them into an array 
                arr   = list()
                while len(arr) < 4: 
                        arr.append(random.choice(lines).strip() )

                # Add a random number and random piece of punctuation
                arr.append(str(random.randint(1000,9999)) )
                arr.append( random.choice(string.punctuation) )          

                # Join the array elements using a random choice of punctiation as a separator
                return random.choice(string.punctuation).join(arr)

print( correct_horse_battery_staple() ) 

# Example Outputs: 
# stepchild$lasagnes$Eridanus$castor's$9080$%
# medic:afforded:Pincus:derailment:6333:]
# mythologies\ankhs\keystroke's\cathodes\6201\(

Correct Horse Battery Staple in Bash

Previously posted in the quality content dump thread.

for i in `seq 1 10`; do nice_dogs=`shuf -n 5 /usr/share/dict/words | tr '\n' '-'` && echo $nice_dogs$RANDOM; done

Users Who Have Downloaded More RAM:
Hash Brown (10 months ago)
🐏 ⨉ 1
Posted by August R. Garcia 10 months ago 🕓 Posted at 16 September, 2019 19:25 PM PDT

Sir, I can do you a nice SEO.

Post a New Comment

Do you like having a good time?

Register an Account

You can also login to an existing account or reset your password. All use of this site is subject to the terms of service and privacy policy.

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account

Answers— Read More

Find more related content below!