๐
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 sys | |
| from typing import BinaryIO | |
| import requests | |
| import time | |
| from cbrrr import CID, encode_dag_cbor, decode_dag_cbor | |
| from atmst.mst.node_store import NodeStore | |
| from atmst.mst.node_walker import NodeWalker | |
| from atmst.blockstore.car_file import ReadOnlyCARBlockStore, encode_varint | |
| from atmst.blockstore import BlockStore, OverlayBlockStore |
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
| /* | |
| NOTE: arithnetic here is NOT CONSTANT TIME | |
| This is mostly ok since we're operating on public keys. | |
| */ | |
| const P256_P = BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"); | |
| const P256_A = BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"); | |
| const P256_B = BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"); | |
| const P256_N = BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"); |
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
| """ | |
| iterate thru /export jsonlines, shove them into ~~sqlite~~ rocksdb, then pull them out | |
| again into a new jsonlines where each line is in /log/audit format for one DID | |
| expects input data in "out.jsonlines" | |
| """ | |
| from tqdm import tqdm | |
| import json | |
| import aimrocks |
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
| No ethernet available | |
| Adding Xtra Brick Ram @0xa000000, Size = 6291264 - 12 cards. | |
| ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] | |
| ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] | |
| ]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]] | |
| ]]]]]]]]]]] ]]]] ]]]]]]]]]] ]] ]]]] TM | |
| ] ]]]]]]]]] ]]]]]] ]]]]]]]] ]] ]]]] | |
| ]] ]]]]]]] ]]]]]]]] ]]]]]] ] ]] ]]]] |
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 unsafe # https://github.com/DavidBuchanan314/unsafe-python | |
| mem = unsafe.getmem() | |
| def very_equal(a: int, b: int) -> None: | |
| addr = id(a) | |
| mem[addr+24:addr+32] = b.to_bytes(8, "little") | |
| very_equal(2 + 2, 5) |
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 magic_numbers import FORTY_TWO, SIXTY_NINE, FOUR_HUNDRED_AND_TWENTY | |
| from magic_numbers import ONE_THOUSAND_THREE_HUNDRED_AND_TWELVE | |
| print(f"{FORTY_TWO = }") | |
| print(f"{SIXTY_NINE = }") | |
| print(f"{FOUR_HUNDRED_AND_TWENTY = }") | |
| print(f"{ONE_THOUSAND_THREE_HUNDRED_AND_TWELVE = }") |
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
| # https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md | |
| import re | |
| import base64 | |
| PHC_STRING_RE = re.compile(r""" | |
| \$(?P<id>[a-z0-9-]{1,32}) | |
| (\$v=(?P<version>[0-9]+))? | |
| (\$(?P<params>[a-z0-9-]{1,32}=[a-zA-Z0-9/+.-=,]*))? # NOTE: full param parse happens later, this just checks at least one param exists | |
| ( |
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
| [ | |
| (try_except := (lambda fn, exception_callback: | |
| type("mycontext", (__import__("contextlib").ContextDecorator,), { | |
| "__enter__": lambda self: self, | |
| "__exit__": lambda self, a, b, c: (a and exception_callback(a, b, c)) or True | |
| })()(fn)() | |
| )), | |
| (throw := lambda e: | |
| (_ for _ in ()).throw(e) |
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
| ( | |
| solve := lambda data: sum( | |
| abs(a - b) for a, b in | |
| zip(*map(sorted,zip(*( | |
| map(int, line.split()) | |
| for line in data.split("\n") | |
| )))) | |
| ), | |
| example := """\ |
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
| #!/bin/bash | |
| # SPDX-License-Identifier: GPL-2.0-only | |
| shopt -s extglob | |
| unshare=0 | |
| keepresolvconf=0 | |
| #!/hint/bash | |
| # SPDX-License-Identifier: GPL-2.0-only |
NewerOlder