Skip to content

Instantly share code, notes, and snippets.

View DiamondDemon669's full-sized avatar

DiamondDemon669

View GitHub Profile
@DiamondDemon669
DiamondDemon669 / pyspeed.py
Last active July 7, 2022 17:41
Pyspeed: an asynchronous CLI tool made to speed up python by avoiding running the script running more than once using sockets and/or files
import asyncio, socket, os, shlex
from watchdog.events import FileSystemEventHandler
from watchdog.observers import Observer
from watchdog.observers.polling import PollingObserver
from multiprocessing import Process
class socket_handler:
def __init__(self):
self.server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
async def run_server(self, address, port, printrun, handle):
@DiamondDemon669
DiamondDemon669 / ascii_hashing.py
Last active January 13, 2021 21:27
Python hashing demonstration. no hashlib or hmac is used to make this. (It is somewhat reversable, but you need either the key or message)
# I have decided to call this the ascii hasher
# new(msg) generates a hash using a psuedo random number with the encoded message as its seed for the key
# new_wkey(key, msg) generates a hash using the key and the message
def new_wkey(key, msg):
enc_key, enc_msg = int(''.join([str(ord(c)) for c in key])), int(''.join([str(ord(c)) for c in msg])) # Generates encoded key and encoded message
added = str(enc_key * enc_msg) # Creates the hash as an integer
if len(added) % 3: # Removes irregularities in the hash
if len("00" + added) % 3:
added = "00" + added