Skip to main content


Showing posts from 2021

Python: PyWeek 32: Lil Miss Vampire

TL;DR A world that scrolls infinitely in any direction, an RPG-like UI, and simple, real-time fighting. My younger kids and I built this entry for PyWeek 32 based on the theme "Neverending". The key innovations are: It has a neverending world. As the player walks along, it picks up tiles and places new ones invisibly. It uses an LRUDict to remember the last million tiles you've seen. This matches real life in that if you go back to a place after 20 years, it'll look different than when you first saw it. The user interface was inspired by Super Mario RPG, but the fighting mechanics are purposely realtime. It's a lot like if you were playing Street Fighter, but all you were allowed to do was use a fast punch, a slow punch, or block. It's a little bit like roshambo. The code: The code is pretty pleasant. I made use of lots of new features in the latest Python, and I built a pretty decent developer experience. It's built on the excellent

Security: What Percentage of Passwords are Pure ASCII?

I was wondering what percentage of passwords are pure ASCII. Hence, I threw together some code: #!/usr/bin/env python3 PASSWORD_LIST = "example.txt" num_pure_ascii = 0 num_iso_8859_1_not_ascii = 0 num_passwords = 0 with open(PASSWORD_LIST, mode="rb") as f: for line in f: password = line.rstrip(b"\n") num_passwords += 1 try: password.decode('ASCII') num_pure_ascii += 1 print("Pure ASCII:", password, flush=True) except UnicodeDecodeError: try: password.decode('UTF-8').encode('ISO-8859-1') num_iso_8859_1_not_ascii += 1 print("ISO-8859-1 (but not pure ASCII):", password, flush=True) except (UnicodeEncodeError, UnicodeDecodeError): print("Not encodable into ASCII or ISO-8859-1:", password, flush=True) percentage_pure_as

Type Annotations T-Shirt


A Space Engine

 (I'm talking about stuff I don't understand, so feel free to ignore me.) Space isn't entirely empty. There are a few hydrogen atoms hanging out here and there. Imagine if a spacecraft was flying really fast, and it was collecting those tiny few. It could either use a massive funnel at the front of it, or it could use something electromagnetic. Once it collects them, it could use fusion to release energy. Then, on the other side of the spacecraft, it could shoot out the output as hard as possible. 

Add Another Entry to the UNIX Haters' Handbook

I was using the command line to quickly build out a file hierarchy. I wrote something that looked basically like: mkdir -p "~/dir/a b/c d" I meant for dir to be in my home directory. I should have put the ~/ outside the doublequotes. Hence, it actually ended up creating a directory called ~ . I thought, "Well that was dumb. Let me delete that and start over..." So I wrote: rm -rf ~ As you can imagine, that started recursively deleting things from my home directory. I should have put the ~ in double quotes or written ./~ . I hit control-c once I started seeing strange errors, but I was a bit late. It started deleting things all over the place. It complained that it couldn't delete a bunch of things in ~/Library , but it did end up deleting a bunch of other things there. Apps started acting strangely or crashing. It deleted my Google Drive settings, but not the files themselves. I was really worried that it'd delete the files and synchronize t

Information Security: SOX, SOC2, ISO 27001, PCI-DSS, OMG!

Introduction Let’s talk about certifications, standards, controls, control frameworks, etc. Let’s start with standards. SOX Per Wikipedia : The Sarbanes–Oxley Act of 2002...more commonly called Sarbanes–Oxley or SOX, is a United States federal law that set new or expanded requirements for all U.S. public company boards, management and public accounting firms. A number of provisions of the Act also apply to privately held companies, such as the willful destruction of evidence to impede a federal investigation. The bill...was enacted as a reaction to a number of major corporate and accounting scandals, including Enron and WorldCom. The sections of the bill cover responsibilities of a public corporation's board of directors, add criminal penalties for certain misconduct, and require the Securities and Exchange Commission to create regulations to define how public corporations are to comply with the law. In a nutshell (and bearing in mind that I am not an expert), SO

Getting Windows 7 Running on a Lenovo Thinkpad T410 with no CDROM Drive and no OEM Software

This is a continuation of Creating Windows 10 Boot Media for a Lenovo Thinkpad T410 Using Only a Mac and a Linux Machine . I figured out that Windows 10 isn't supported on the Lenovo Thinkpad T410, so I decided to focus on getting Windows 7 running on it, which is what it came with. I know it's a security risk, but I figured it'd be okay if I locked down the firewall, installed a virus scanner, and limited the apps installed on the machine. There's nothing on this laptop that we can't afford to lose. Remember, one of my challenges was that the laptop doesn't have a CDROM drive, and I didn't have any installation media at all. I just had a Mac to work with. Attempt 24: I bought a license key from . I was hoping to download an ISO either from them or from Microsoft . It turns out Microsoft wouldn't let me download the ISO since it was an OEM license. I also bought a copy of McAfee AntiVirus Plus at the same time. I never