Skip to content

Instantly share code, notes, and snippets.

View smitelli's full-sized avatar

Scott Smitelli smitelli

View GitHub Profile
@smitelli
smitelli / ti250tool.py
Created May 31, 2022 19:51
Klein Tools TI250 image tool
# Klein Tools TI250 image tool by Scott Smitelli. Public domain.
# Requires at least Python 3.6 (developed and tested on 3.9)
# See https://www.scottsmitelli.com/articles/klein-tools-ti250-hidden-worlds
import argparse
import numpy as np
import re
import struct
from PIL import Image, ImageDraw
@smitelli
smitelli / hex_dump.py
Created April 27, 2024 21:37
A teeny tiny xxd clone in a ten-line Python function
import math
import re
def hex_dump(data, cols=16):
data_len = len(data)
addr_pad = math.ceil(data_len.bit_length() / 4)
for i in range(0, data_len, cols):
paragraph = data[i:i + cols]
hex_view = paragraph.hex(' ', 1).ljust(cols * 3)