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
frofrom typing import Union | |
from filetype.types import application, archive, audio, document, font, image, video | |
ImageFileType = Union[ | |
image.Dwg, | |
image.Xcf, | |
image.Jpeg, | |
image.Jpx, | |
image.Apng, |
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
{ | |
"manifest_version": 3, | |
"name": "Superpower ChatGPT", | |
"version": "5.1.2", | |
"key": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzG6ZR+j3lpHF0XrDLIXdrk25idObfq+RK7WM+pIaQmDO2nM5Y+SZJJbFwyxjWX+3V6XOgS5v9Lpnqg46OJ/W9Q5i23Usx1MXgaJBTlEFz0XG+PYK6BElhc9itS7m6oCLknin97a533tusXmm8zW7kaDGy8vycMDY6Ffbqa3sn0PqZ8bXUlAjgO91dQcB8EtlT906hwhZjtfEYvp2hdxYkRFxfuaR1WMLkxttVXv506RXJowxq0LO3aqj83QeJoXkQF1wbzCxYO1VpVGEmYIQxIKw/csusZNZs8gwJrIWtOzhMgDNOFzXNeZl0ASgoj2M9UsZp+Dunn57VT8tQyaE6QIDAQAB", | |
"description": "ChatGPT with superpowers! Sync/search history locally, create folders, export all chats, pin messages, access thousands of prompts", | |
"icons": { | |
"16": "images/icon-16.png", | |
"32": "images/icon-32.png", | |
"48": "images/icon-48.png", |
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 ast | |
import astor | |
import tkinter as tk | |
from tkinter import scrolledtext, IntVar, Checkbutton | |
class EllipsisTransformer(ast.NodeTransformer): | |
def __init__(self, remove_args, remove_methods): | |
self.remove_args = remove_args | |
self.remove_methods = remove_methods |
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
{ | |
"$schema": "http://json-schema.org/draft-07/schema#", | |
"type": "object", | |
"properties": { | |
"services": { | |
"type": "array", | |
"items": { | |
"type": "object", | |
"properties": { | |
"type": {"type": "string"}, |
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
def path_walk(path: str) -> Generator[str, None, None]: | |
"""Walks a directory tree yielding all files and directories. | |
This uses a breadth-first algorithm. | |
""" | |
queue = deque([path]) | |
while queue: | |
current = queue.popleft() | |
for entry in os.scandir(current): | |
entry: os.DirEntry |
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, sys | |
from ctypes import windll, wintypes | |
from uuid import UUID | |
class GUID(ctypes.Structure): # [1] | |
_fields_ = [ | |
("Data1", wintypes.DWORD), | |
("Data2", wintypes.WORD), | |
("Data3", wintypes.WORD), | |
("Data4", wintypes.BYTE * 8) |
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
with suppress(FileNotFoundError): | |
with open('.env') as f: | |
line = f.readline() | |
while line: | |
k, v = line.split('=', 1) | |
os.environ[k] = v.strip() | |
line = f.readline() |
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
class SetQueue(Queue): | |
def _init(self, maxsize): | |
self.queue = set() | |
def _put(self, item): | |
self.queue.add(item) | |
def _get(self): | |
return self.queue.pop() |
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 time | |
from pathlib import Path | |
import pywintypes | |
import win32con | |
import win32file | |
import winerror | |
WATCHED_DIR = str(Path("./").absolute()) |
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
# based on https://stackoverflow.com/a/56428123/23972 | |
import commonmark | |
def docstring(app, what, name, obj, options, lines): | |
if len(lines) > 1 and lines[0] == "@&ismd": | |
md = "\n".join(lines[1:]) | |
ast = commonmark.Parser().parse(md) | |
rst = commonmark.ReStructuredTextRenderer().render(ast) | |
lines.clear() |
NewerOlder