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 dataclasses import dataclass | |
| from typing import Iterable | |
| @dataclass(frozen=True, slots=True) | |
| class Program: | |
| state: tuple[int, int] | |
| instructions: list[str] | |
| @property |
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
| ; Converts a two-byte value to BCD | |
| ; Works in const time, no jumps | |
| ; params: `hl` - word value | |
| ; return: `ahl` - 5 digits in BCD | |
| ; spoils: `f`, `c` | |
| ; time: 454, length: 112 | |
| wordToBcd: | |
| IFUSED | |
| ; double dabble algorithm | |
| xor a |
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 numpy as np | |
| from sys import byteorder | |
| _utf32 = 'utf-32-le' if byteorder == 'little' else 'utf-32-be' | |
| _braille_char_base = 0x2800 # U+2800 BRAILLE PATTERN BLANK | |
| _braille_matrix = np.array([ | |
| [0x01, 0x08], |
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
| comment_char % | |
| escape_char / | |
| % English locale for Antarctica | |
| % Source: | |
| % Address: | |
| % Contact: | |
| % Email: | |
| % Tel: | |
| % Fax: |
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
| Disassembly of section .text: | |
| 00000000 <cast_to_uint16>: | |
| 0: cf 93 push r28 | |
| 2: df 93 push r29 | |
| 4: 0f 92 push r0 | |
| 6: cd b7 in r28, 0x3d ; 61 | |
| 8: de b7 in r29, 0x3e ; 62 | |
| a: 89 83 std Y+1, r24 ; 0x01 | |
| c: 89 81 ldd r24, Y+1 ; 0x01 |
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
| T = TypeVar('T') | |
| K = TypeVar('K') | |
| def group_by(iterable: Iterable[T], key: Callable[[T], K]) -> Dict[K, List[T]]: | |
| groups: Dict[K, List[T]] = {} | |
| for item in iterable: | |
| k = key(item) | |
| if k in groups: groups[k].append(item) | |
| else: groups[k] = [item] | |
| return groups |
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
| using System; | |
| using System.Drawing; | |
| using System.Runtime.InteropServices; | |
| using Teclado.Common; | |
| namespace Teclado.WinApi | |
| { | |
| public static class Hooks | |
| { | |
| #region Public methods |