Skip to content

Instantly share code, notes, and snippets.

View CDE90's full-sized avatar

Ethan Coward CDE90

View GitHub Profile
@CDE90
CDE90 / remove_duplicates.py
Created September 4, 2024 20:58
A simple python script to remove duplicate files from a directory
import hashlib
import os
import sys
def calculate_file_hash(file_path):
"""Calculate the SHA-256 hash of a file."""
hash_algo = hashlib.sha256()
with open(file_path, "rb") as file:
while chunk := file.read(8192):
@CDE90
CDE90 / photoai-dot-com-exporter.py
Last active September 4, 2024 21:42
photoai.com image exporter. Automatically downloads all generated images from photoai.com.
# Install aiohttp before running: pip install aiohttp
import asyncio
import os
import aiohttp
# Define the base URL and headers
base_url = "https://photoai.com/"
hash_string = "00112233445566778899aabbccddeeff" # Taken from inital email or use devtools to find
@CDE90
CDE90 / rpn_calculator.hs
Last active January 18, 2025 18:01
Reverse Polish Notation Calculator (In Haskell)
import Data.Char (isDigit)
------------------------- RPN Calculator
data Expr = Num Int | Add | Neg | Div | Mult | Dupl | Kill | Swap | Thrd
deriving (Show, Eq)
type Expression = [Expr]
from __future__ import annotations
from collections.abc import Mapping, Sequence
from typing import Literal
class DFA[S, A]:
"""
Represents a Deterministic Finite Automaton (DFA).