Skip to content

Instantly share code, notes, and snippets.

View Jawschamp's full-sized avatar
:octocat:
Working on Project Magma Python and Web stuff.

Jaws Jawschamp

:octocat:
Working on Project Magma Python and Web stuff.
View GitHub Profile
@Jawschamp
Jawschamp / Birthday Cacu.py
Last active November 23, 2023 22:08
Not anything elaborate but some challenged me to do this in like 5 mins so I did
import datetime
def get_time_remaining_until_birthday(dob_m: int, dob_d: int, dob_y: int):
today = datetime.datetime.now()
birthday = datetime.datetime(today.year, dob_m, dob_d)
if birthday < today:
birthday = birthday.replace(year=today.year + 1)
delta = birthday - today
return (delta.days // 30, delta.days % 30, today.year - dob_y + 1)
@Jawschamp
Jawschamp / replit_db.py
Last active November 15, 2022 07:15
Simple script to interact with a Replit database.
from replit import db as database
class DatabaseFunctions:
def __init__(self, key: str):
self.key_ = key
def write_data(self, **kwargs):
for key, value in kwargs.items():
database[self.key_] = {key: value}
@Jawschamp
Jawschamp / pos_char.py
Last active September 17, 2022 12:24
Get position of a character (clarity and testing purposes a 1 is added to each position)
def char_pos_parser(parse_string: str, pattern: str):
char_dict = {}
char_array = []
found_pat_array = []
pos_array = []
for i in enumerate(parse_string):
char_array.append(i)
for chars in char_array:
char_dict[chars[0]] = chars[1]
for key, value in char_dict.items():
@Jawschamp
Jawschamp / YouTube_TimeStamp.py
Last active October 28, 2022 07:03
Simple YouTube timestamp converter for Python (simple thing I needed for a project) | Right now it only supports 4 digit numbers: (mm:ss)
class TimestampConverter:
def __init__(self, time_):
self.time_ = time_
self.len_dig = len(self.time_)
self.time_array = []
if self.len_dig == 4:
self.time_array.append(self.time_[:2])
self.time_array.append(self.time_[2:])
first = int(self.time_array[0]) * 60
second = int(self.time_array[1])
@Jawschamp
Jawschamp / parse_wheel_files.py
Last active February 23, 2022 06:08
Simple Python script that parses all file wheels (needs to be optimized)
import wheel_filename
import requests
from requests_html import HTMLSession
import re
from typing import NoReturn
class ParsePythonWheelFiles:
def __init__(self, wheel_file_name, module_name) -> NoReturn:
self.wheel_file_name = wheel_file_name
@Jawschamp
Jawschamp / Learn Binary.md
Last active October 23, 2021 15:53
Learn Binary Easy and Fast

Reading Binary

You calculate binary by reading right-to-left example below (so for example the word: Binary would be read as yraniB got it? Hope so. ←>→

Image of 8 numbers being 0's and 1's

remember that 0's means 🟩 and 1's are 🟥 (aka on or off)

[40][55][63][17][22][68][89][97][89]
0 1 2 3 4 5 6 7 8
repeater:
89 x2 pos 6, 8
Array Length:
8 pos
first index:
0
last index:
8
import requests
import json
from flask import Flask, send_file
from threading import Thread
import time
# Constants. These should not be tampered with.
app = Flask(__name__)
Thread(target=app.run, args=("0.0.0.0", 8080)).start()