2012 to 2019

Origins

This is the archive of the 55+ projects I built while teaching myself Python from 2012 to 2019: 45,000+ lines of Python 2.7, most of it desktop software with Tkinter interfaces.

The projects start as single-file scripts in 2012 and end as applications with several modules, background threads, encryption and Windows integrations, and each one was a way to learn a new area. The archive is complete rather than selected, so it shows the unfinished experiments alongside the tools I used every day, and the reflections further down are as honest about the mistakes as about what went well.

55+
Projects Built
45,000+
Lines of Code
10
Domains Explored
7
Years of Self-Teaching
Deep Dives

The Largest Projects

Six projects from the archive, described with their structure and what each of them taught me.

VoiceRec

Windows Voice Assistant

Spoken commands, spoken answers

2013-2017 1,850+ lines 6 modules

VoiceRec is a voice-controlled assistant for Windows that I built and extended between 2013 and 2017, several years before voice assistants such as Alexa were common in homes: speech recognition software, first Microsoft's and later Dragon NaturallySpeaking, turned my spoken commands into text, and VoiceRec answered with synthesised speech. It controls music and video playback, answers questions from Wikipedia and keeps the answers between sessions, posts to Twitter and Facebook, and switches the general-purpose input/output (GPIO) pins of a Raspberry Pi over SSH. Building it was my first experience of coordinating several external services and background threads in one application, which is the same problem that integrating language models and their APIs presents today.

Architecture
voice.py (1,341 lines): application, interface and command handling
ConfigFile.py (159 lines): first-run setup and saved settings
musicPlayer.py (147 lines): music playback and playlists
vlcmovie.py (118 lines): video playback through VLC
ai.py (88 lines): Wikipedia answers with a saved cache
MoppleMods.py (1,756 lines): the shared utility library
Six integrations: Windows speech synthesis (SAPI), Twitter, Facebook, Wikipedia, Microsoft Translator and SSH
Background threads for idle detection, command processing and music status, stopped together through one shared flag
A question-and-answer cache stored with pickle, so a repeated question was answered without a second lookup
Developed in versions over four years, with a configuration format that was upgraded between releases
Python 2.7 Windows SAPI COM Twitter API Paramiko SSH Tkinter

MoppleMods

The Shared Library

One library behind 27 of the projects

2013-2016 1,700+ lines 1 module

MoppleMods is the utility library that I wrote once and imported into 27 of the other projects, with 16 classes and 19 functions for user interfaces, encryption, networking, audio and system information. Keeping the shared code in one place meant that a fix reached every project that used it, and the library also handled missing optional libraries without failing, so a project that did not need audio or SSH still ran on a machine without them.

Architecture
Encryption: AESCipher, HashAlgorithms, KeyBuilder
User interface: PopUp, Balloon_Widget, ErrorCatcher, Timer
System: ScreenResolution, External_IP, Pcinfo, memory statistics
Files: get_size, zipper, Tempfiles, PickleConfig
Media: MusicPlayer, PygamePlayer
Remote: SendCommand (an SSH wrapper around Paramiko)
1,756 lines: 16 classes and 19 functions
Imported by 27 of the other projects in the archive
Optional imports wrapped so that a missing library disabled one feature only
Random 32-byte keys for AES-256 encryption, used by the file encryption tools
Python 2.7 PyCrypto Paramiko Pygame Win32 COM Tkinter

RPG Game Engine

Roguelike Dungeon Crawler

A complete game, from rules to sound

2013-2014 1,650+ lines 7 modules

The RPG Game Engine is a complete roguelike game that I built with a Tkinter interface, in which a hero explores a dungeon, fights monsters in turn-based combat and finally meets a boss. Its characters, items, map, dice and battles each live in their own module, which was my first experience of dividing a larger program into parts. The hand-built map is a grid of 28 by 43 squares, and random events such as encounters, treasure, riddles and changes to a hero's abilities make each game different.

Architecture
game.py (688 lines): game loop, map display and events
characters.py (309 lines): four hero classes, ten monsters and the boss
items.py (297 lines): equipment and inventory
BattleEvent.py (200 lines): animated combat
dice.py (98 lines): two six-sided dice plus ability scores
maps.py (46 lines): the hand-built map
cards.py (19 lines): cards for random events
Four hero classes: Mage, Barbarian, Thief and Paladin
Ten monster types in three levels, plus a final boss
Combat decided by two six-sided dice plus each character's abilities
A grid of 1,204 squares with the walls defined by hand
Python 2.7 Tkinter Canvas PIL pymedia Threading

Network Toolbox

Seven Network Tools in One Window

Ping, subnets, ports and more

2014 1,700+ lines 7 modules

The Network Toolbox is a desktop application with seven network tools on separate tabs: ping, a subnet calculator, a network address list generator, a port scanner, a binary, decimal and hexadecimal converter, a hash calculator, and an FTP password tester. I built it in 2014, while I studied network engineering, and each tab implements its tool directly on network sockets and the standard library. The FTP password tester showed me in practice how quickly a weak password falls to an automated attack.

Architecture
toolbox.py (679 lines): the tabbed main window
portscan.py (210 lines): TCP port scanning with a database of known ports
ftpcrack.py (196 lines): threaded password testing against FTP
calcsubnet.py (100 lines): subnet calculation from CIDR notation
converter.py (221 lines): binary, decimal and hexadecimal conversion
genlist.py (93 lines): address lists for a network
iptools.py (161 lines): address helpers
Port scanner that works in batches of 256 ports and pauses between batches to avoid flooding the network
Subnet calculator for network address, broadcast address and number of usable hosts
FTP password tester with 1 to 100 threads and a live rate of attempts per second
Network adapter settings read from the Windows registry
Python 2.7 Socket Tkinter Pmw ftplib Threading

SafeTalk

Encrypted P2P Chat

Encrypted chat without a server

2014-2015 800+ lines 2 modules

SafeTalk is an encrypted chat application in which two people connect directly to each other, with no server in between. Because there is no server, no third party ever holds the messages, and every message is encrypted with AES, using a key derived from a password both people know, before it leaves the computer. Its network code has separate classes for plain messages, for files sent in chunks of 1,024 bytes, and for messages framed with their length so that they arrive complete.

Architecture
safetalk.py (589 lines): interface, chat and the list of friends
sockets.py (213 lines): three connection classes
  BasicTCP: a plain TCP connection
  FileTransfer: files sent in 1,024-byte chunks
  ReliableMsg: messages framed with their length
Direct connections between friends, configured by address and port
Messages encrypted with AES and encoded with Base64 for transport
File transfer in 1,024-byte chunks
Chat history saved between sessions
Python 2.7 PyCrypto Socket Base64 Tkinter

Hash Cracker

Password Hash Testing Tool

How weak passwords fail

2013-2015 1,250+ lines 2 modules

The Hash Cracker is a tool that I wrote to test how quickly a password can be recovered from its stored hash, for the NTLM, SHA-1, MD5 and WPA2 formats. Building it showed me how attacks on passwords work, which is the knowledge needed to protect credentials properly. It tries passwords from wordlists or generates every combination of a character set, and the second version separated the interface from the work and replaced the original threading with a class-based design.

Architecture
crack.py (755 lines): the first version, with wordlists from an FTP server
newcrack.py (531 lines): the rewrite, with the interface separated
  from the hashing work and a cleaner class structure
Hash formats: NTLM, SHA-1, MD5 and WPA2
Three modes: wordlists kept on a server, a local wordlist, and every combination of a character set
NTLM hashes computed correctly by encoding the password as UTF-16LE before MD4
Live progress: attempts per second, estimated time left and percentage done
Python 2.7 hashlib PyCrypto ftplib Tkinter Threading
The Breadth

10 Areas of Work

I followed whatever I wanted to understand next, so the projects cover a wide range of areas rather than one.

GUI Utilities & Desktop Tools

12 projects · ~5,500 lines

WordManipulator, FNFRenamer, IT Planner, Process Manager

External merge sort for files larger than RAM

Networking & Security

9 projects · ~4,200 lines

Network Toolbox, MAC Changer, SSH Executor

Changing a network adapter's MAC address through the Windows registry

Cryptography & Encryption

4 projects · ~2,800 lines

Hash Cracker, Crypter, SafeTalk, Password Manager

AES-256-CBC with random IV generation

Game Development

3 projects · ~2,200 lines

RPG Engine, Text Adventure, Hearthstone Framework

A complete roguelike with four hero classes and a final boss

Media & Entertainment

6 projects · ~1,800 lines

Axxo Monitor, MovieDB Creator, Music Player

A background monitor that skipped duplicates by their SHA-1 hash

Bitcoin & Cryptocurrency

3 projects · ~580 lines

EazyWallet, Mining Pool Client, Wallet Recovery

A live Bitcoin dashboard with controls for mining

IoT & Hardware

4 projects · ~720 lines

Raspberry Pi Controller, 433 MHz Radio, Sensor Reader

GPIO pin control with Dropbox synchronisation

Voice & AI

1 project · ~1,850 lines

VoiceRec

Spoken commands through speech recognition, and six integrations

Libraries & Templates

8 projects · ~5,000 lines

MoppleMods, Project Template, Progressbar Module

35 reusable classes and functions that tolerate missing libraries

Learning & Exploration

10 projects · ~2,000 lines

Socket Programming, PyQt4 Examples, Pygame Tutorial

Small exercises written while learning each new framework

Evolution

How the Code Improved

Four techniques traced from the first projects to the last, showing how each one improved over the years.

Threading

Early

Deprecated Threads

thread.start_new_thread()

Mid

Thread Subclassing

threading.Thread with daemons

Later

Queue-Based Pools

Work queues with metrics

Mature

Signal Handling

Background services that shut down cleanly

Cryptography

Early

Basic Hashing

MD5, which worked but is weak

Mid

Key Derivation

SHA-256 with 4,096 rounds

Later

Symmetric Encryption

AES in CBC mode with a random IV

Mature

Multi-Algorithm Suite

Seven hash types and PBKDF2

Architecture

Early

Single Scripts

Each tool in one file

Mid

Procedural Tools

Tools split across several files

Later

Class Hierarchies

Classes that build on each other

Mature

Multi-Module Applications

Seven-module programs and peer-to-peer networking

User Interfaces

Early

Static Layouts

Basic Tkinter widgets

Mid

Dialog Workflows

Pmw widgets and forms in several steps

Later

Canvas Rendering

Animation, sprites and graphics

Mature

Responsive Interfaces

Background threads keep the window responsive

Looking Back

Honest Reflections

Looking at the archive today, there are things I would do differently and things I would do the same way again.

What I Would Do Differently

Credentials in the source code

API keys, email passwords and SSH credentials were written directly into the source files in plain text, often in more than one project. Finding them again years later is what taught me, in a way no guideline had, why a secret belongs in a secrets store and is read from the environment when the program runs, which is how the projects I build today handle them.

Python 2 only

Every project is written for Python 2.7, which was still the common choice when I started and reached the end of its support in 2020. The print statements and urllib2 imports date the code at a glance, and none of it would run on a current Python without changes.

Global state

Most projects share data through module-level global variables. That is workable in a small desktop tool written by one person, but it makes the code hard to test and hard to change, and it is one of the first things I avoid in new code today.

Almost no tests

My project template created a tests directory for every new project, but most of those test files are empty. I knew that tests belonged in a project before I had the habit of writing them, and today a change is not finished until its tests pass.

Unfinished projects

At least eight of the projects are stubs or skeletons, started with enthusiasm and left when the next idea arrived. Taking a project to a finished state is a skill of its own, and it is one I learned later than the programming itself.

What Worked

Breadth

Working on networking, encryption, games, hardware, voice control, media automation and Bitcoin gave me a picture of how the parts of a computer system connect, and platform engineering draws on that picture every day.

Building tools I used

Most of these projects were tools I used myself: the MAC address changer, the file renamer and the movie database builder each solved a problem I had at the time. Because I was the first user of everything I wrote, I met every rough edge myself, and I still try a tool on my own work before anyone else depends on it.

A shared library

Writing MoppleMods once and importing it into 27 other projects was my first practical experience of reusing code rather than copying it, and of the care that a dependency shared by many projects needs.

Rewriting my own code

Several projects exist in two or three versions, such as sort, sort2 and sort3, or crack.py and newcrack.py, and each version improves the structure of the one before. Rewriting my own code taught me to read it critically.

Software for other people

Several projects were packaged as standalone Windows programs with py2exe, including the Tcl/Tk runtime, so that they ran on computers without Python. That was my first experience of the difference between code that runs on my own machine and software that someone else can install and use.

From the Early Projects to Platform Engineering

Many of the techniques I use as a platform engineer started in these projects, and each pair below links an early project to the work that grew out of it.

Then
Port scanning and subnet calculation

Network Toolbox

Now
Networking for a Kubernetes cluster

K3s, MetalLB, ingress

Then
MAC addresses and encryption tools

MAC Changer, Hash Cracker

Now
Security as part of the design

Vigil, MopPilot, Smithe

Then
File renamers and backup tools

FNFRenamer, Sorter, Backup

Now
CI/CD and GitOps automation

Argo CD, GitHub Actions

Then
Raspberry Pi GPIO control

Raspberry Pi Controller

Now
Running a Kubernetes cluster

Home Lab Infrastructure

Then
Windows registry and COM objects

VoiceRec, MAC Changer

Now
Operating system troubleshooting

Platform engineering at work

Then
Work queues and background threads

FTP password tester, SafeTalk

Now
Asynchronous processing

Celery, Redis, Kubernetes

The code is old, written for Python 2 and with credentials in places where they should never have been, but the habit of building something in order to understand it started in these projects, and it is still how I work today.

From the Archive to Today

The archive holds 55+ projects across 10 areas, and the six above are the largest of them. The projects I build today continue where these left off.