Skip to content

Instantly share code, notes, and snippets.

View megahomyak's full-sized avatar
🙂
Hamburger

megahomyak

🙂
Hamburger
View GitHub Profile
@megahomyak
megahomyak / disable_or_enable_windows_defender.bat
Last active March 20, 2024 08:03
Disable or enable Windows Defender (DISABLE TAMPERING PROTECTION MANUALLY FIRST!!!)
@ECHO OFF
if not "%1"=="am_admin" (powershell start -verb runas '%0' am_admin & exit /b)
set /p what_to_do=enable or disable windows defender?:
if "%what_to_do%"=="disable" (
set state=1
) else (
if "%what_to_do%"=="enable" (
set state=0
@megahomyak
megahomyak / youtube-dl.bat
Created December 28, 2020 21:36
A batch file that is just a shortcut for youtube-dl
@ECHO OFF
set /p url=url:
set /p audio_extracting=do extract audio or no (yes/no)?:
if "%audio_extracting%" == "yes" (
youtube-dl %url% -x --audio-format mp3
) else (
if "%audio_extracting%" == "no" (
youtube-dl %url%
) else (
echo choice isn't recognized
import time
class Sleepy(type):
def __getitem__(cls, value):
if isinstance(value, slice):
if value.step is None:
# start:stop
# minutes:seconds
from dataclasses import dataclass
from typing import Optional
import random
@dataclass
class Chunk:
"""
ALL FIELDS HERE ARE JUST DEMO STUBS!!! THEY ARE NOT USED ANYWHERE EXCEPT
FOR PRINTING OUT THE DATACLASS!!!
@megahomyak
megahomyak / pypiupload.bat
Created January 5, 2022 10:30
Small batch script for myself to automate some of the pypi's repetitive package uploading
python setup.py sdist
twine upload dist/*
rmdir dist /s /q
@megahomyak
megahomyak / coefficients_bruteforce.py
Last active February 6, 2022 21:12
Finds coefficients for quadratic equations using bruteforce. Use only when you cannot find them by yourself
known_points = [(-2, -1), (-3, 1), (1, 5)]
step = 0.25
max_value = 3
a = -max_value
while a <= max_value:
b = -max_value
while b <= max_value:
@megahomyak
megahomyak / color_converter.py
Created August 19, 2022 15:27
256-256-256 RGB HEX => it's-your-choice RGB => 256-256-256 RGB HEX. Used to convert some 256-256-256 colors to 8-8-4.
def tuple_to_hex(tup):
return "".join(map(
lambda n: hex(n)[2:].zfill(2),
tup
))
def hex_to_tuple(h):
return tuple(int(h[i:i+2], 16) for i in range(0, 6, 2))
@megahomyak
megahomyak / quick_soundboard.py
Created August 26, 2022 13:10
A tiny soundboard written in three minutes.
from readchar import readchar
from playsound import playsound
import os
sound_names = os.listdir("sounds")
letters_to_names = dict(zip("abcdefghijklmnopqrstuvwxyz1234567890", sound_names))
for letter, name in letters_to_names.items():
print(f"{letter} - {name}")