scripts

My personal collection of scripts
git clone git://src.gearsix.net/scripts
Log | Files | Refs | Atom | README | LICENSE

commit 87f50a16af29c93fa9cf6040b2ada3e46cd5d8fd
parent 9a382febd9fb8998a580ac01ea2e52271170f073
Author: gearsix <gearsix@tuta.io>
Date:   Thu,  9 Jun 2022 12:27:51 +0100

added d2h.py, h2d.py; moved nix/pyserve.py -> pyserve.sh

Diffstat:
Md2h.py | 2+-
Ah2d.py | 13+++++++++++++
2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/d2h.py b/d2h.py @@ -6,7 +6,7 @@ while (True): d = input('> ') if d.isdigit(): print(hex(int(d))) - elif d == 'q' or d == 'quit or ' d == 'exit': + elif d == 'q' or d == 'quit' or d == 'exit': exit() else: print(d, 'is not a number') diff --git a/h2d.py b/h2d.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# hex to decimal +# description: convert hexadecimal to decimal + +while (True): + h = input('> ') + try: + print(int(h, 16)) + except ValueError: + if h == 'q' or h == 'quit' or h == 'exit': + exit() + else: + print(h, 'is not hexadecimal')