Skip to content

Instantly share code, notes, and snippets.

@reganto
reganto / captcha.py
Created Apr 6, 2020
A simple captcha with python
View captcha.py
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
reganto / substitute.py
Created Feb 18, 2019
Substitute indices in Python strings
View substitute.py
# 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
reganto / password.py
Created Jul 26, 2018
simple gen and hash password
View password.py
import string
import random
import uuid
import hashlib
import os
def gen_password():
print("Gen Password . . .\n")
try:
password = input("Enter a password or Enter . to generate one :")