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
const zero_ascii = '0'.charCodeAt(0); | |
let text_decoder = new TextDecoder(); | |
export function* readTNetstringPrefix() { | |
let length = 0; | |
while (true) { | |
const read_byte = yield 1; | |
if (read_byte >= zero_ascii && read_byte <= zero_ascii + 9) { |
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
#!/usr/bin/env python3 | |
# Copyright (c) 2010 Joshua Harlan Lifton. | |
# See LICENSE.txt for details. | |
# | |
# keyboardcontrol.py - Abstracted keyboard control. | |
# | |
# Uses OS appropriate module. | |
"""Keyboard capture and control. |
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 json, struct | |
########################## | |
#### data decoding to json | |
key_order = ["#", "S", "T", "K", "P", "W", "H", "R", "A", "O", "*", "E", "U", "F", "R", "P", "B", "L", "G", "T", "S", "D", "Z"] | |
keys = [(2**(len(key_order) - index -1), key) for (index, key) in enumerate(key_order)] | |
keys.insert(key_order.index("*") +1, (~0, "-")) |