Skip to content

Instantly share code, notes, and snippets.

View Alexandr6363's full-sized avatar
🤝

ALEX_R Alexandr6363

🤝
View GitHub Profile
@Alexandr6363
Alexandr6363 / renamer.py
Created May 14, 2022 07:19
A simple program in Python for renaming multiple files that checks and it does not overwrite old files that match to our pattern
from os import rename, path, listdir
try:
path_of_dir = input('Enter path of directory with your file:')
ext = input('Print file extension (unquoted) (".jpg" for example):')
list_of_filename = listdir(path_of_dir)
count = 1
for file in list_of_filename:
full_old_name = path.join(path_of_dir, file)
new_name = "{:0>6}".format(count) + ext
@Alexandr6363
Alexandr6363 / pass_gen.py
Last active May 14, 2022 07:20
Easy password generator in Python with iteration next/yield
from string import ascii_lowercase, ascii_uppercase
import random
chars = ascii_lowercase + ascii_uppercase + "0123456789!?@#$*"
n = int(input("Enter password length: "))
m = int(input("Enter how many passwords to generate: "))
def gen_char_password(n):
for i in range(n * m):
@Alexandr6363
Alexandr6363 / substitution.c
Created February 4, 2022 09:17
CS50 (cs50x) pset2 Substitution Solution 2022
#include <ctype.h>
#include <cs50.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
//prototype
string valid_key(string key);
string do_text(string start_text, string key);
void swap(char *a, char *b);