This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ctypes | |
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("company.app.1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from logging import Handler | |
from logging import LogRecord | |
from PyQt6.QtCore import QObject | |
from PyQt6.QtCore import pyqtSignal | |
COLORS = { | |
logging.DEBUG: "#0071A6", | |
logging.INFO: "#0071A6", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import concurrent.futures | |
from tqdm import tqdm | |
from glob import glob | |
def process_file(file_path): | |
os.system(f'"C:\Program Files\LibreOffice\program\swriter.exe" --headless --convert-to pdf {file_path}') | |
def process_files_with_threads(): | |
files = list(glob('*.xlsx')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import subprocess | |
threshold = 10 # GB | |
webhook_url = "https://discord.com/api/webhooks/xxx/xxx" | |
environment = "my-server-name" | |
free_space = ( | |
int( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
def get_expo_backoff( | |
base: int, attempts: int = 1, cap: int = 100_000_000, jitter: bool = True | |
): | |
""" | |
Returns a backoff value https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/ | |
:param base: The time to sleep in the first attempt. | |
:param attempts: The number of attempts that have already been made. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input:-webkit-autofill, | |
input:-webkit-autofill:focus { | |
transition: background-color 600000s 0s, color 600000s 0s; | |
} | |
input[data-autocompleted] { | |
background-color: transparent !important; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proxy_set_header HOST $host; | |
proxy_set_header X-Forwarded-Proto $scheme; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header X-Forwarded-Referrer $http_referer; | |
proxy_set_header Referer $http_referer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git -c rebase.instructionFormat='%s%nexec GIT_COMMITTER_DATE="%cD" GIT_COMMITTER_NAME="%aN" GIT_COMMITTER_EMAIL="%aE" git commit --amend --no-edit' rebase -i --root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sentry_sdk | |
from sentry_sdk.integrations.logging import LoggingIntegration | |
sentry_logging = LoggingIntegration(event_level=logging.CRITICAL) | |
sentry_sdk.init( | |
dsn=SENTRY_DSN, | |
traces_sample_rate=1.0, integrations=[sentry_logging], | |
ignore_errors=[KeyboardInterrupt], | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
import os | |
import sys | |
from logging import Formatter | |
from logging import LogRecord | |
from logging import StreamHandler | |
from logging.handlers import RotatingFileHandler | |
class ColorFormatter(logging.Formatter): |
NewerOlder