Adventures in Python
Last Updated: March 30 2022
To further my professional goals I have been learning and re-learning Python. This page features some of those sillier advances in my knowledge past what I learned in college.
TCX Converter - March 30 2022
I needed a way to pull coordinates from a provided TCX file from some GPS enabled smartwatch or another. That's all this does, badly. But it did allow me pull the X/Y values into ArcMap.
Links:tcx_convert_2.py
Avatar Generator - March 30 2022
I wanted to try some image generation of some kind that involved iterative, non-random creation. I'm not quite sure if Pillow (the current fork of PIL) was the right direction for this but I did manage to create something capable of this sort of output in a few hours from scratch.
Normally, I would shy from non-standard libraries but embracing libraries really is a part of the Python philosophy so I should just get over myself. Using Pillow I was able to generate a series of small 16x16 images and paste them together using some goofy logic onto a 256x256 canvas. In other words, it's a 16x16 image blown up to be human-friendly.

Like most of my projects, especially these programming examples, I worked on this until a base level of functionality existed, and I probably will not revisit it. But you never know, I might use this when trying to figure out GUI's and other higher level beginner tasks. The output from this script using the name of my site is now the new favicon.png.
Links:
avgen_03.py
Scrambled Eggs - May 14 2021
I had this idea rattling around in my brain for a while to encrypt text in a manner that took into account each letter's position within the text. The original plan was to alternately rotate each letter up or down by where the letter is. The first letter rotates up one position, the second rotates down two positions, and so on. To further complicate matters, the position of spaces within the plaintext would be flipped. As an example:
turns into
Translating this scheme into Python threw up some road-blocks. Translating the space transformation was easy, but it really did not handle punctuation, special characters, or text that mixed encoding very easily. It still doesn't, but I modified the code to take into consideration some text that isn't purely alphabetical.
What I ended up doing is taking each line to be converted and deriving a custom list of characters that the plaintext would rotate through. In a nutshell, it would test each character in the line for inclusion in a list, sort that list, and add it to the default list (the alphabet). This allows the ciphertext to include punctuation, numbers, etc. in strange looking positions and frequencies. I also set it so the first character in each line would not be rotated- in Python this is position 0, so it rotates zero times. There is no particular reason for this. I also made this script not respect case, so everything is UPPERCASE.
turns into
I also made it require two functions, one for encoding, and one for decoding. I could probably make this whole script better but I'm not going to. Probably. Feel free to look at my code and test it out.
Links:
scrambled_eggs.py
scrambled_eggs_test.txt