Skip to content

Instantly share code, notes, and snippets.

View DiamondDemon669's full-sized avatar

DiamondDemon669

View GitHub Profile
@DiamondDemon669
DiamondDemon669 / wgtables
Last active April 13, 2023 17:35
wgtables: a configuration tool for wireguard
#!/usr/bin/python3
import os, sys, re
#---------------------------------------------------------------------------
#Thank you to https://gist.github.com/dfee/6ed3a4b05cfe7a6faf40a2102408d5d8|
IPV4SEG = r'(?:25[0-5]|(?:2[0-4]|1{0,1}[0-9]){0,1}[0-9])' #|
IPV4ADDR = r'(?:(?:' + IPV4SEG + r'\.){3,3}' + IPV4SEG + r')' #|
IPV6SEG = r'(?:(?:[0-9a-fA-F]){1,4})' #|
IPV6GROUPS = ( #|
r'(?:' + IPV6SEG + r':){7,7}' + IPV6SEG, #|
@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 / si.sh
Created January 12, 2021 11:24
SImple SHell (SISH) is a basic command line.
#!/bin/bash
while true
do
echo -n "$USER@$(hostname):$PWD> "; eval $(head -1)
done
@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