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 weakref | |
| class A: ... | |
| def test_() -> None: | |
| o = A() | |
| ref = weakref.ref(o) | |
| assert ref() is not None | |
| del o | |
| assert ref() 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
| def fake() -> None: | |
| print("fake") | |
| @lambda this: fake | |
| def x() -> None: | |
| pass |
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 typing import TypeAlias, TypeVar | |
| T = TypeVar("T") | |
| Tuple6: TypeAlias = tuple[T, T, T, T, T, T] | |
| OCTET_MAX = 0xFF | |
| def parse(octets: Tuple6[str]) -> int: # like: int(str, 16) |
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
| --- | |
| x-logging: &logging | |
| driver: json-file | |
| options: | |
| max-size: 1m | |
| max-file: 3 | |
| compress: 'true' | |
| services: | |
| linux: |
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
| # STM32F411CEU6: 100MHz Arm Cortex-M4 core with DSP and FPU, 512KB Flash, 128KB SRAM, ART Accelerator | |
| # https://stm32-base.org/boards/STM32F411CEU6-WeAct-Black-Pill-V2.0.html | |
| # increase working area to 128KB | |
| set WORKAREASIZE 0x20000 | |
| set CHIPNAME STM32F411CEU6 | |
| source [find interface/stlink.cfg] | |
| # source [find interface/stlink-dap.cfg] | |
| # source [find interface/stlink-v2-1.cfg] |
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
| Add | |
| scrub on bridge100 all min-ttl 65 | |
| to | |
| '/etc/pf.conf' | |
| Reload with | |
| sudo pfctl -f /etc/pf.conf | |
| Check with | |
| sudo pfctl -sa |
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
| task = asyncio.create_task(read_output()) | |
| handler = event_loop().call_later(2, cancel_asyncio_task, task) | |
| task.add_done_callback(lambda _: handler.cancel()) | |
| await task |
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 logging | |
| from base64 import b64encode | |
| from json import loads as jsdecode | |
| from urllib.parse import urlencode | |
| from enum import Enum | |
| from http.client import HTTPConnection | |
| from time import sleep | |
| from random import uniform | |
| from typing import Union |
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 inspect import Parameter, signature | |
| from typing import Any, Optional | |
| def fn(i: int, z: Optional[str] = None, *a, v: int = -1, **kw: Any): | |
| pass | |
| if __name__ == '__main__': | |
| p = signature(fn).parameters |
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
| def lock(res): | |
| pass | |
| def free(res): | |
| pass | |
| class MyCtx(object): | |
| __slots__ = ('res',) |
NewerOlder