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 PyQt5.QtWidgets import QProgressBar | |
from qasync import QApplication | |
import functools | |
import asyncio | |
import qasync | |
import sys | |
async def main(): | |
def close_future(future, loop): | |
loop.call_later(10, future.cancel) |
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 traceback as _traceback | |
import sys | |
def traceback(exc: Exception = None): | |
# Full error traceback with line numbers and previews | |
if exc: | |
exc_info = type(exc), exc, exc.__traceback__ | |
else: | |
exc_info = sys.exc_info() |
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
example = ["abc", "def", "ghi"] | |
def join_words(words): | |
return (", ".join(words[:-1]) + (" and " if len(words) > 1 else "") + words[-1]) if len(words) > 0 else "" | |
result = join_words(example) | |
print(result) | |
# abc, def and ghi |
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 | |
class Singleton: | |
def __init__(self, app_id: str): | |
if os.name == 'nt': | |
# Requirement: pip install pywin32 | |
import win32api, win32event, winerror | |
self.mutexname = app_id | |
self.lock = win32event.CreateMutex(None, False, self.mutexname) |
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 contextlib import contextmanager | |
import sys | |
import re | |
import os | |
# Fix missing streams | |
for stream in ("stdout", "stderr", "stdin"): | |
if getattr(sys, stream) is None: | |
setattr(sys, stream, open(os.devnull, "w+")) |
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
# Color escape code using rgb values (0-255) | |
def rgb(r, g, b): | |
return f'\x1b[38;2;{r};{g};{b}m' | |
# Primer for windows' cmd to enable color escape codes | |
import sys | |
if sys.platform == 'win32': | |
from ctypes import windll, c_int, byref, c_void_p | |
ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x0004 | |
INVALID_HANDLE_VALUE = c_void_p(-1).value |
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 collections import defaultdict | |
import functools | |
events_callbacks = defaultdict(list) | |
def callback(event_id: str): | |
def decorator_callback(func): | |
functools.wraps(func) | |
events_callbacks[event_id].append(func) |
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
🌞 Morning 84 commits █▉░░░░░░░░░░░░░░░░░░░ 9.1% | |
🌆 Daytime 180 commits ████░░░░░░░░░░░░░░░░░ 19.5% | |
🌃 Evening 374 commits ████████▍░░░░░░░░░░░░ 40.4% | |
🌙 Night 287 commits ██████▌░░░░░░░░░░░░░░ 31.0% |
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
⭐ Total Stars 288 | |
✅ Total Commits 46.1k | |
🔀 Total PRs 130 | |
🚩 Total Issues 47 | |
📦 Contributed to 29 |
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
C +3.9k -2.1k ████████████████▍░░░░ 78.5% | |
CSV +272 -274 █▌░░░░░░░░░░░░░░░░░░░ 7.5% | |
Markdown +249 -78 █▎░░░░░░░░░░░░░░░░░░░ 6.5% | |
YAML +164 -23 ▉░░░░░░░░░░░░░░░░░░░░ 4.3% | |
Python +86 -30 ▍░░░░░░░░░░░░░░░░░░░░ 2.1% | |
Shell +53 -0 ░░░░░░░░░░░░░░░░░░░░░ 0.5% | |
Diff +16 -18 ░░░░░░░░░░░░░░░░░░░░░ 0.5% | |
CMake +8 -8 ░░░░░░░░░░░░░░░░░░░░░ 0.2% | |
TOML +4 -0 ░░░░░░░░░░░░░░░░░░░░░ 0.1% | |
JSON +1 -1 ░░░░░░░░░░░░░░░░░░░░░ 0.0% |
OlderNewer