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 shutil | |
from contextlib import ExitStack | |
def create_folder(stack: ExitStack, path): | |
try: | |
os.mkdir(path) | |
except FileExistsError: | |
pass |
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.abc import Iterable | |
import math | |
import heapq | |
import random | |
from collections import deque | |
import time | |
type WeightedOptions = list[tuple[int, int]] | |
UP = 0b1000 |
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 re | |
def extract_variables(endpoint: str): | |
""" | |
Very simple route "parsing" using regex: | |
The route: | |
"/item/{item_id}" |
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
<?php | |
namespace Vendor\MyExt\Xclass; | |
use TYPO3\CMS\Core\Http\ServerRequest; | |
use TYPO3\CMS\Core\Http\Uri; | |
use TYPO3\CMS\Core\Routing\SiteMatcher; | |
use TYPO3\CMS\Core\Site\Entity\NullSite; | |
use TYPO3\CMS\Core\Site\Entity\Site; | |
use TYPO3\CMS\Core\Utility\GeneralUtility; |
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 Colors: | |
COLOR_NAMES = [ | |
'black', | |
'red', | |
'green', | |
'yellow', | |
'blue', | |
'purple', | |
'cyan', | |
'white', |
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 math | |
import random | |
from typing import NamedTuple, Literal, Callable | |
import pygame | |
from PIL import Image | |
import numpy as np | |
type Pos = tuple[int, int] | |
type Color = tuple[int, int, int] | str |
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 asyncio | |
import threading | |
import pygame | |
USER_EV1 = pygame.event.custom_type() | |
def pygame_loop(async_stopper): | |
pygame.init() |
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 dataclasses import dataclass, field | |
import struct | |
from typing import BinaryIO | |
import zlib | |
import typing | |
""" | |
TFG1 Data files desired to be extracted (data directory) | |
https://gitea.xanax.lol/root/tfg-client |
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 random | |
from PIL import Image, ImageDraw | |
COLORS = [ | |
(0x5e, 0x1f, 0x1d), (0xaa, 0x38, 0x37), (0x41, 0x2c, 0x33), (0xb3, 0x5a, 0x48), (0xfd, 0x63, 0x65), | |
(0xa0, 0xa5, 0xa9), (0x6c, 0x6e, 0x68), (0xb2, 0x00, 0x2a), (0xc0, 0x12, 0x26), (0xe1, 0x53, 0x85), | |
(0x93, 0x37, 0x4e), (0xe6, 0xa0, 0xc5), (0xe3, 0xb4, 0xa4), (0x00, 0x00, 0x00), (0x24, 0x27, 0x28), | |
(0x3f, 0x41, 0x41), (0x67, 0x1b, 0x56), (0x90, 0x00, 0x45), (0x34, 0x21, 0x50), (0x83, 0x58, 0x8b), | |
(0xa1, 0x89, 0xae), (0xd1, 0xb4, 0xc8), (0x87, 0x8e, 0x90), (0xa2, 0xa8, 0xab), (0xff, 0xff, 0xff), | |
(0x0a, 0x1a, 0x19), (0x23, 0x28, 0x1c), (0x34, 0x3b, 0x22), (0x61, 0x5c, 0x3d), (0x4f, 0x73, 0x6e), |
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 choose(text, options="Yn"): | |
""" | |
text: prompt to the user. | |
options: set of characters. one upper case may be | |
used to indicate a default value. | |
Examples: | |
answer = choose("Continue?") | |
# outputs: "Continue? (Y/n): " |
NewerOlder