-
-
Save Giszmo/03d1036d287f300992ec to your computer and use it in GitHub Desktop.
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
# this little script helps me enter bitcoin addresses in bitcoin-core. | |
# It enters an address that I scan, skips to the value field, enters 3 | |
# and adds another recipient. I made it to charge paper wallets with 3mɃ. | |
import os | |
import time | |
from subprocess import Popen, PIPE | |
upper_pattern='xte "keydown Shift_L" "key {}" "keyup Shift_L"' | |
default_pattern='xte "key {}"' | |
ord_A=ord("A") | |
ord_Z=ord("Z") | |
def echochar(char): | |
pattern=default_pattern | |
if len(char) == 1 and ord(char) >= ord_A and ord(char) <= ord_Z: | |
pattern=upper_pattern | |
os.system(pattern.format(char)) | |
def echostr(str): | |
for char in str: | |
echochar(char) | |
p = Popen(['zbarcam', '--raw'], stdout=PIPE, stderr=PIPE, stdin=PIPE) | |
while True: | |
time.sleep(0.1) | |
code = p.stdout.readline().strip() | |
print('Got barcode: {}'.format(code)) | |
echostr(code) | |
echochar("Tab") | |
echochar("Tab") | |
echostr("3") | |
os.system('xte "keydown Alt_L" "key r" "keyup Alt_L"') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment