From 735782be32c6fca65a0b2bd8c4310533d57b610a Mon Sep 17 00:00:00 2001 From: ubq323 Date: Sun, 16 Apr 2023 12:18:31 +0100 Subject: initial commit of dot files --- .local/bin/ud | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 .local/bin/ud (limited to '.local/bin/ud') diff --git a/.local/bin/ud b/.local/bin/ud new file mode 100755 index 0000000..a1a50ac --- /dev/null +++ b/.local/bin/ud @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +# unidump version 0.1.1 +# made by ubq323 in the year 2021 +# please use this software for GOOD, not for EVIL + +import unicodedata +import sys + +uniquify = True +arg="" +args = sys.argv[1:] +while len(args) > 0: + arg = args.pop(0) + if arg[0] != '-' or arg == "--": + break + if arg == "-a": + uniquify = False + arg = "" + + +s = arg+" ".join(args) + +if len(s) == 0: + s = sys.stdin.read() + +def row(c): + try: + name = unicodedata.name(c).rjust(50) + except ValueError: + name = "?"*50 + + number = ("U+"+hex(ord(c))[2:].zfill(4)).rjust(7).upper() + + to_c = c + if c == '\n': + to_c = ' ' + + + + return f"{to_c} | {unicodedata.category(c)} | {name} | {number}" + +seen = set() +for c in s: + if uniquify: + if c in seen: + continue + seen.add(c) + print(row(c)) -- cgit v1.2.3