Skip to content

Instantly share code, notes, and snippets.

reganto /
Created Apr 6, 2020
A simple captcha with python
from random import choice
from operator import add, mul, sub
def captcha():
try_count = 0
while True:
numbers = [number for number in range(1, 5)]
operators_functions = [add, mul, sub]
operators_functions_litrals_map = {add: "+", mul: "*", sub: "-"}
reganto /
Created Feb 18, 2019
Substitute indices in Python strings
# substitute indices in Python strings
def substitute(entry, i, j):
entry = list(entry)
entry[i], entry[j] = entry[j], entry[i]
return ''.join(entry)
# call sample
reganto /
Created Jul 26, 2018
simple gen and hash password
import string
import random
import uuid
import hashlib
import os
def gen_password():
print("Gen Password . . .\n")
password = input("Enter a password or Enter . to generate one :")