Skip to content

Instantly share code, notes, and snippets.

View tomghuang's full-sized avatar

Tom G. Huang tomghuang

View GitHub Profile
@tomghuang
tomghuang / nitf-glas.md
Created November 2, 2025 05:25
Get GLAS DES TRE records from NITF files

What is desc?

desc is a list of lists (or nested list) that defines the structure of the data fields for the DesCSATTB class. Each inner list represents a field in the data structure, with the following components:

  • Field Name: A string representing the name of the field (e.g., "qual_flag_att").
  • Description: A string describing the purpose of the field (e.g., "Attitude Data Quality Flag").
  • Field Length: An integer or a reference indicating the size of the field (e.g., 1 or "f.reserved_len").
  • Data Type: The type of data stored in the field (e.g., int, float, or None).
  • Optional Metadata: A dictionary (optional) that provides additional information about the field, such as formatting or conditions.
#import readline # optional, will allow Up/Down/History in the console
import code
vars = globals().copy()
vars.update(locals())
shell = code.InteractiveConsole(vars)
shell.interact()
@tomghuang
tomghuang / knownpaths.py
Created October 14, 2015 20:28 — forked from surreylabs/knownpaths.py
Python wrapper around the SHGetKnownFolderPath Windows Shell function
import ctypes, sys
from ctypes import windll, wintypes
from uuid import UUID
class GUID(ctypes.Structure): # [1]
_fields_ = [
("Data1", wintypes.DWORD),
("Data2", wintypes.WORD),
("Data3", wintypes.WORD),
("Data4", wintypes.BYTE * 8)