Software Tools

When I’m doing repetitive things, I often end up creating quick and dirty tools to help me do that thing. Sometimes I loose track of them or forget I created them.

These tools often often built to be configured at a code level. I run them from the command line but they might not take any input. All input is done via code. I’ll encapsulate a bunch of functionality in functions, then call those functions from a main function with things like hardcoded paths or parameters. My goal is to create a tool for my own use, not a tool for general use, and I find it easier to modify the code than to waste time creating a bunch of stdarg flags that I’ll forget how to use in a week.

fixscan.go

This tool does content aware thresholding/tweaking of scanned magazine page images. I specifically created it for processing scans of Northern Circuit. At the core of it is a flood fill algorithm that gathers chunks of semi-contiguous non-whitespace areas of pixels. If a chunk contains colour pixels, it is left untouched. If a chunk contains a large amount of monochrome pixels, it’s determined to be a monochrome image, and is adjusted to be true monochrome. The remaining chunks are determined to be text, and are hard-limited to produce nice black and white text. The “white space” pixels are all turned to pure white. The end result is a clean scan that looks as good as the original, but that compresses very nicely.

Source: fixscan.go

pcbnetbuilder.go

This tool takes a json file that describes a traced PCB in terms of pads, vias and traces represented as separate line segments. It reassembles the nets and generates a netlist. This netlist can then be used to re-create a schematic of the PCB. Currently it only supports two layer boards. In my use, the json file is generated by some scripts I created inside my CAD software.

Source: pcbnetbuilder.go

Sample Input: combined.json