Skip to content

Instantly share code, notes, and snippets.

@PyMaster22
PyMaster22 / 2d-vector.py
Last active April 16, 2022 22:14
a stupid vector class cause why not
import math
class Vector:
"""a stupid vector class cause why not"""
def __init__(self,x,y):
"""initalize self with x and y"""
if((type(x)not in[int,float])or(type(y)not in[int,float])):raise TypeError("no")
self.x=x
self.y=y
def __repr__(self):
return(f"V({self.x},{self.y})")
@PyMaster22
PyMaster22 / underload.py
Last active February 22, 2022 17:33
Underload in python
def underload(code,stack=[],out="",emulator=0):
depth=0
tmp=""
for cmd in code:
try:
if(depth==0):
if(cmd=="~"):
tmp1=stack[-1]
tmp2=stack[-2]
stack[-1]=tmp2
@PyMaster22
PyMaster22 / RSA_gen.py
Created November 13, 2020 19:28
Generates RSA keys
import os, math
key_name = input("Private key name: ")
try: security = int(input("Secity level:\n[1] 1024\n[2] 2048\n[3] 4096\n[4] Custom\n\n[3]"))
except ValueError: security = 3
if(security == 4): security = math.log2(int(input("Bits: "))) - 9
cmd = "openssl genpkey -algorithm RSA -out ./"+key_name+" -pkeyopt rsa_keygen_bits:"+str(2 ** (int(security) + 9))+";openssl rsa -in ./"+key_name+" -pubout -out ./"+key_name+".pub"
os.system(cmd)
@PyMaster22
PyMaster22 / half-life-3.CONFIRMED
Created June 3, 2020 04:40
Ascii Art Of Half-Life: Alyx "Logo"
| | /\ | |== | === |== |==
|==| /==\ | |== | | |== |==
| | / \ |=== | |=== === | |==
/\ | \ / \ /
/==\ | | X
/ \ |=== | / \