Last active
August 21, 2022 12:54
-
-
Save ungeskriptet/ee05c74f665b427dbf64bdedd22b7122 to your computer and use it in GitHub Desktop.
Very stupid tool to check if one hex value is higher or lower than another. Useful for checking the placement of a node in a device tree.
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 python | |
import sys | |
def main(): | |
while True: | |
str1 = input("First address: ") | |
str2 = input("Second address: ") | |
if not str1.startswith("0x"): | |
str1 = "0x" + str1 | |
if not str2.startswith("0x"): | |
str2 = "0x" + str2 | |
if int(str1, 16)< int(str2, 16): | |
print("All good :)\n") | |
else: | |
print("Not good! Place {} lower than {}\n".format(str1, str2)) | |
if __name__ == "__main__": | |
try: | |
main() | |
except KeyboardInterrupt: | |
print("\nCaught KeyboardInterrupt, exiting …") | |
sys.exit() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment