This file contains hidden or 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 +19.2k -3.8k ███████████████████▌░ 93.1% | |
| Python +413 -222 ▋░░░░░░░░░░░░░░░░░░░░ 3.1% | |
| TypeScript +305 -20 ▎░░░░░░░░░░░░░░░░░░░░ 1.2% | |
| Markdown +78 -21 ▏░░░░░░░░░░░░░░░░░░░░ 0.8% | |
| JavaScript +117 -18 ░░░░░░░░░░░░░░░░░░░░░ 0.6% | |
| CSV +58 -19 ░░░░░░░░░░░░░░░░░░░░░ 0.6% | |
| C++ +115 -47 ░░░░░░░░░░░░░░░░░░░░░ 0.6% | |
| YAML +3 -3 ░░░░░░░░░░░░░░░░░░░░░ 0.1% | |
| Linker Sc… +7 -0 ░░░░░░░░░░░░░░░░░░░░░ 0.0% | |
| JSON +5 -4 ░░░░░░░░░░░░░░░░░░░░░ 0.0% |
This file contains hidden or 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 568 | |
| ✅ Total Commits 78.2k | |
| 🔀 Total PRs 275 | |
| 🚩 Total Issues 64 | |
| 📦 Contributed to 48 |
This file contains hidden or 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 287 commits ████▏░░░░░░░░░░░░░░░░ 19.7% | |
| 🌆 Daytime 386 commits █████▌░░░░░░░░░░░░░░░ 26.5% | |
| 🌃 Evening 422 commits ██████░░░░░░░░░░░░░░░ 29.0% | |
| 🌙 Night 361 commits █████▏░░░░░░░░░░░░░░░ 24.8% |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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) |
NewerOlder