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
| # /// script | |
| # requires-python = ">=3.9" | |
| # dependencies = [ | |
| # "opencv-python-headless", | |
| # ] | |
| # /// | |
| from pathlib import Path | |
| import cv2 |
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 deque | |
| from threading import RLock | |
| from typing import Any, ClassVar | |
| import msgspec | |
| def cached_call(func): | |
| def wrapper(*args, **kwargs): | |
| if not (len(args) < 2 or args[1] is None): |
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 enum import Enum | |
| class ECapID(Enum): | |
| AresPointID = "85ad13f7-3d1b-5128-9eb2-7cd8ee0b5741" | |
| UpgradeTokenID = "e59aa87c-4cbf-517a-5983-6e81511be9b7" | |
| RecruitmentTokenID = "f08d4ae3-939c-4576-ab26-09ce1f23bb37" | |
| JuiceEnergyCurrencyID = "537bdf46-41ce-832a-8d79-328ec29d8a96" | |
| JuiceMaxEnergyCurrencyID = "1e259454-4958-6ab9-1de7-739fe08c46bd" | |
| DoughID = "85ca954a-41f2-ce94-9b45-8ca3dd39a00d" | |
| EquippableContentTypeID = "51c9eb99-3e6b-4658-801f-a5a7fd64bb9d" |
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 json | |
| from io import BytesIO | |
| from pathlib import Path | |
| from struct import Struct | |
| from typing import TYPE_CHECKING | |
| from PIL import Image | |
| from PIL.PngImagePlugin import PngImageFile | |
| if TYPE_CHECKING: |
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
| # original: | |
| # https://github.com/SteamDatabase/ValveResourceFormat/blob/8ff0321c9ec6f5c0d487515fc87346cd02fac949/ValveResourceFormat/ClosedCaptions/ClosedCaptions.cs | |
| import struct | |
| FILE_PATH = r"D:\subtitles_english.dat" | |
| with open(FILE_PATH, "rb") as f: | |
| magic, version = struct.unpack("<4sI", f.read(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
| import pefile | |
| def get_product_version(data: bytes) -> str: | |
| pe = pefile.PE(data=data, fast_load=True) | |
| pe.parse_data_directories( | |
| directories=[pefile.DIRECTORY_ENTRY["IMAGE_DIRECTORY_ENTRY_RESOURCE"]] | |
| ) | |
| for file_info in pe.FileInfo: | |
| for entry in file_info: |