Skip to content

Instantly share code, notes, and snippets.

View kirisakow's full-sized avatar

Kiril Isakov kirisakow

View GitHub Profile
@kirisakow
kirisakow / decipher-a-garbled-paypal-sms-string-supposed-to-be-in-russian.ipynb
Last active July 27, 2025 14:31
Decipher a garbled PayPal SMS string supposed to be in Russian.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kirisakow
kirisakow / get_checksum.py
Created April 9, 2025 20:26
Python function that computes checksum of a file using one of hashlib algorithms (default: SHA-256). It combines a "modern" implementation with a pre-Python3.11 compatible alternative.
from typing import Union
import hashlib
import os
def get_checksum(path_to_file: str, algorithm: Union[str, callable] = hashlib.sha256) -> str:
"""A function that computes checksum of a file using one of hashlib algorithms (default: SHA-256). It combines
a "modern" implementation with a pre-Python3.11 compatible alternative."""
if not os.path.exists(path_to_file):
raise FileNotFoundError(f"File {path_to_file!r} doesn't seem to exist")