My Favorite Books From 2023

In what seems to be a new annual tradition, I'd like to discuss my favorite books from 2023. While I didn't achieve the same level of reading as 2022, last year was still one of the most productive reading years I've ever had—18 in total! You can see the totals of the books on my reading progress page, which at time of writing will look off since it doesn't count audiobooks in the counts (something I need to fix).

As a side note, I am curious if I can somehow automate the posting of recommended/recent books on that page. An interesting idea ๐Ÿค”

In no particular order here are the books I recommend from last year:

The Book of Hidden Things, Francesco Dimitri

Francesco is quickly becoming my favorite author. I read Never the Wind last year and fell in love with his writing, and The Book of Hidden Things is more of the same excellent storytelling. Seriously, check him out.

Also he has a new book coming out this year, which I have already pre-ordered.

The Ocean at the End of the Lane, Neil Gaiman

This one was a really fun read. Neil Gaiman is a master and it shows. Really enjoyed this one, but I don't have much to say about it. A lovely story.

The Internet Newspaper, Adam Gnade

The cover hooked me immediately when I picked this one up on a whim from a local bookstore. The story takes place in San Diego (the author's and my hometown). If you like San Diego, 90's/00's music, and early 20-somethings mischief you'll like this. Also I love the size of this thing. Pocket novels are a lost medium.

The Secrets of Alchemy, Lawrence Principe

The book is an overview of the history of the practices of alchemy (mostly attempts to create a philosopher's stone and turn lead to gold), though it touches on the other uses for alchemy including metallurgy, medicine, and pre-modern chemistry. However the book really hits it out of the park when Principe does the homework and attempts to replicate several of the ancient alchemical recipes! Instantly I was hooked.

I read a lot of ancient history and one things I always try to keep in mind is that while ancient worldviews are very different from our own, and scientific thinking as we know it today didn't exist yet, that doesn't mean that people weren't experimenting, verifying, and sharing their ideas. For years people dismissed old alchemical recipes because we know their goal (chemically turn lead to gold) to be impossible, but that doesn't mean their experiments were useless, as Principe discovers. Some were very nuanced and precise. 10/10, fascinating read. Highly recommended.

It's available to rent for free on the Internet Archive, so please check it out.

Beren and Luthien, J.R.R. Tolkein

I read a lot of Tolkien this year and this one was my favorite. It's a little happier than the excellent Children of Hurin and features some of my favorite scenes from The Silmarillion. Basically if you enjoyed that chapter with the same name in The Silmarillion, you'll love this.

My favorite part: the song battle between a demi-god and an elf lord. 10/10. No notes.

Experimenting With The Game Of Life

As I am want to do, I spent an evening a while back putting together a Python version of John Conway's Game of Life: a "zero-player game" in which the board state progresses automatically according to a set of rules.

You can find the code for the game here. It requires just the Python standard library to run, so its easy to get started assuming you have Python >=3.10 installed. (It might run on lower than that but I didn't test it.)

A screenshot of the Game of Life

A screenshot of my version of The Game of Life

Gameplay Video
Thrilling, right?

The initial board state for the game is randomized so each run-through is unique. Some end immediately, so you may have to run the script several times to see something cool happen.

Because it's written in Python, the game is single threaded and quite lacking in raw performance, but because it's written in Python the game was also incredibly easy to put together—taking about three hours in total including debugging, though I did spend three more hours optimizing the render performance for no reason.

As with most of my recent script projects, I don't really have a point or reason for doing it other than to have some fun building toy projects. Like I've said before:

Scripts are programming candy whereas app development is the real meat and potatoes. In a script you can take shortcuts, be a bit messy, and forgo worrying about the complexities of large software.
- Take A Break, Script Something

In that same time I've also thrown together a few little scripts to visualize the chaos of the Collatz Conjecture and simulate the dynamics of 2-D gas expansion. Are these important? Nope, not at all. Were they fun? Yes, yes they were.

Building Bots For Fun And…

For all of the good things about Mastodon and the Fediverse more broadly, the technology has so far struggled to spread far outside of tech circles and into the broader public. Mastodon especially is pretty big these days, but its mostly filled with a lot of computer nerds like myself; there really isn't a very large music scene like there is on other social media sites.

I wanted to help fix that, so I threw together a simple Mastodon bot (a toot bot?) that regularly shares information about local music shows in San Diego.

With the San Diego Reader as its data source, the bot posts every hour about shows happening in the next day or two. Hopefully it will help my fellow San Diegans keep tabs on the music scene, and help to inspire more musicians and local music fans onto the platform.

So if you're at all interested in the San Diego music scene, be sure to follow sdmusiceventsbot on Mastodon! And if you're a local artist, make sure you add your event to the Reader to get yourself noticed by the bot! Be warned, San Diego has a lot of shows (more than the bot could ever reasonably post without looking like spam), so not all shows will get posted. The choices are random, so it's all up to the luck of the dice.

Announcing Paper Peaks

Nearly two years ago, my band The Fourth Section released an EP called Glass & Stone and this month we released our first, full-length album: Paper Peaks.

Recording an album has been a long-time goal of mine and something we as a band have been working toward for over three years.

I don't have much to say about the album, other than you should listen to it, but I can say it's been a true honor to have been able to make something like this with such amazing people. The three of us have worked hard since March to record, produce, publish, and promote the thing and it's taken a lot more out of us than I think we expected. Paper Peaks was a labor of love and something that could not have been done save for the support of my bandmates, our producer Jeff Berkley, and so many others.

If you like indie-rock and alt-rock, give it a listen and if you like it, please share it with your friends.

Some Thoughts On Adventurer's Codex

Last year Adventurer's Codex reached its 8th birthday. It's a milestone that I honestly didn't believe we'd ever hit, both because eight years is a long time and because—if I'm honest—I've never been sure how long this little project would actually last.

These days Adventurer's Codex is primarily built and maintained by three people: two are founders (including myself) and the third is a friend of ours, and as with any long-lived side-project Adventurer's Codex has occasionally suffered a lack of interest or enthusiasm from all of us. At the beginning the three founders met every week (sometimes twice a week) to build new features and plan the roadmap, later we rarely met at all, and sometimes nearly a year could go by before any of us even thought about Adventurer's Codex at all.

These days though the app is alive and healthy and with the support of our amazing patrons on Patreon we continue to make improvements and release features at a steady pace, and this year we're set to release a slate of amazing features that eight-years-ago-me could only dream of.

It makes me very happy to say this: the future is very bright for Adventurer's Codex.

More Scripting Nonsense: Rocket Edition

I was browsing my Github Gists the other day, as you do, and I came across my first one published back in 2015: Rocket.py. This script was one part of a rocket trajectory simulator I built for a class in college. Now I don't remember much about that project, but I do remember that the simulation never actually worked—or rather that it never worked properly.

A screenshot of the trajectory over time

So since I had some idle time on my hands, I decided to spend an evening and take another stab at the project. These days I'm a far better programmer but I remember next to nothing about rocketry, and so I added a bit of a challenge for myself: try to look up as little as possible.

About two hours later I had this, a new rocket simulation that seems to produce accurate values (if you neglect drag—more on that later). Now my first simulation only output a set of numerical values for each second of flight, and while those numbers were useful for the class, they're not very interesting to look at so I added a little visualization (drawn with Python's turtle graphics).

Each phase of the flight is color-coded: green for powered flight, blue for cruising, and red for descent, and the flight statistics seem accurate enough to me when I plug in the numbers for the first stage of SpaceX's Falcon 9, so that bodes well. And at the end of each flight you get a summary readout in the terminal.

The code is pretty full-featured, and since it uses turtle graphics (and my other drawing project) it can even save the trajectories as EPS files for easy printing & saving. You can customize the launch angle, the burn time, specific impulse, fuel and payload weights and even the screen refresh rate using the many CLI flags. The script requires nothing but Python3.10 or later (with the tkinter module included of course), and so it's easy to play with if you're interested.

All in all it was a fun evening project, and I was especially surprised to find that I remembered a lot more of the intricacies than I expected. I still had to look up the equations for specific impulse, but that was it really. The kinematics stuff was beaten into my head in school so I doubt I'll ever forget that. Really the only thing that gave me any trouble was the drag—which I decided to omit anyway.

A screenshot of the stats of the flight in the Terminal

I had initially wanted to add the drag based on the mach number, but my memory failed me on how to do that and late-night searching only threw me down a rabbit hole of further questions. Past me knew a lot more about this stuff than current me does. In the end the drag was a nice-to-have feature anyway and by the time I got to that point it was nearly one in the morning, so I just declared victory and went to bed.

I have no real point to this post other than to show how much (and how little) I remember about rocket mechanics after all these years and to show off a cool bit of scripting. It's toy projects like this that got me interested in programming and they can be a really fun way to spend an idle evening.


Disclaimer: I think the values in the simulation make sense, but I didn't spend too much time validating them. If there's any real rocket people out there who find issues with my results, then I'm sorry; now you know one of the reasons I didn't go into aerospace.

A Cross Post Life

I use Pine.blog for microblogging, and following the Post Once Sindicate Elsewhere strategy, I like to have those updates automatically cross-posted to other platforms like Micro.Blog and Twitter so that they gain a larger audience, and so that anyone who wants to can follow me no matter which platform or software they prefer.

Obviously I'm not manually posting to five different sites—that's what computers are for—and so I need some way to automate that work. Micro.blog makes most of that very easy since it can automatically ingest content from an RSS feed and not only add it to my microblog there, but also cross-post it to Twitter. That only leaves Mastodon out in the cold.

In recent months there's been a lot of new activity on Mastodon and I've really enjoyed seeing a larger segment of people discover such a great open-web focused tool. It was well past time that I add Mastodon to my cross-posting workflow, but there was a problem: Mastodon's posts are text only (with links at the bottom—like Twitter), but Pine.blog outputs HTML (or Markdown). I tried several tools, but each one would mangle my posts or just include the raw HTML as the text, neither of which was an acceptable solution. I needed something custom.

So I wrote a script! It runs every few minutes on the Raspberry Pi under my desk checking for new posts from Pine.blog and posting them to Mastodon. It starts with the raw Markdown, parses the HTML, strips and appends links, and even keeps track of what has and hasn't been posted before. It's a pretty handy script and I encourage you to check it out if you need something like it. I even made use of one of Mastodon's very handy features: Idepotency-Key which helps prevent duplicate entries from being posted in a short period of time.

As of today my posts are now Live On Mastodon, so you can rest assured that if you follow me there you aren't missing a beat. You'll get all... five posts I've made this year!

Automate the Boring Stuff with ChatGPT

There's been a lot of buzz around ChatGPT lately and most recently the discussion followed Tom Scott's video in which he describes how he was able to use ChatGPT to generate working code to solve a problem—including asking it to fix several bugs with its own implementation—and then write an ad spot for him.

In the video Tom expresses his disquiet with the ongoing advances in machine learning and goes so far as to predict that "everything is about to change" in the same way "everything changed" once smartphones came along in the mid-aughts.

I've enjoyed using text-to-image AIs like Midjourney for a while now, but I'd largely stayed clear of things like ChatGPT. Tom's video though got me curious, and so I logged on to see what all the fuss was about.

tl;dr I was pleasantly surprised.

Introducing DeveloperGPT

There are so many things that developers do day-to-day that are at the same time important and dreadfully dull, and like many devs I find myself searching for ways to both save time and automate away as much menial work as I can. It's one of the reasons I love Bash so much. And while at some companies such work is often pawned off to junior developers in need of experience, as a one-man shop I have definite use for a sort of algorithmic junior developer who could take on some of that less-engaging work. And after watching Tom's video I started to hope that perhaps ChatGPT could be exactly that.

In order to see if ChatGPT could fill this role, I did what anyone looking to hire a junior developer would do: I gave it an interview.

Giving ChatGPT a Coding Interview

In total I gave ChatGPT five questions to answer. These questions were almost entirely development related and spanned the range of what I'd expect a junior developer to be able to do given time and access to the internet.

Test 1: Django Unit Tests: โœ…
Prompt

write for me 4 python django unit test cases that each make a request to /api/users to do the following: create a user record, fetch a user record, delete a user record, and update a user record. Make sure to include partial update using the PATCH method. And be sure to use Python 3.10 compatible code.

Response

Sure, here are 4 Python Django unit test cases that cover the create, fetch, delete, and update functionality of the /api/users endpoint. These test cases assume that you have a Django application with a User model and a corresponding API viewset that handles CRUD operations for users.

from django.urls import reverse
from rest_framework.test import APITestCase
from rest_framework import status
from .models import User

class UserTests(APITestCase):
    def test_create_user(self):
        """
        Ensure we can create a new user object.
        """
        url = reverse('user-list')
        data = {'username': 'testuser', 'email': 'test@example.com'}
        response = self.client.post(url, data, format='json')
        self.assertEqual(response.status_code, status.HTTP_201_CREATED)
        self.assertEqual(User.objects.count(), 1)
        self.assertEqual(User.objects.get().username, 'testuser')

        # ... (mine: omitted for brevity) ...
Complete Generated Source Code→

These test cases cover the basic functionality of the /api/users endpoint and ensure that users can be created, fetched, updated, and deleted. They also cover partial updates using the PATCH method. Note that you will need to update the URLs used in the reverse() function to match the actual URLs for your application.

The first test I gave ChatGPT was simply to write a suite of unit tests to verify that a Django User REST API allowed for standard CRUD operations. In general it did very well, even including a test for partial updates via the PATCH method, but it did assume I also wanted it to use Django REST Framework and its implementation of the PUT and POST tests don't include all the correct values. The assumption to use DRF is a fair one, but the other mistake is a red flag.

Still though it would have saved me from writing the bulk of the code—assuming it works. I didn't actually test the code.

Test 2: S3 File Clean Up: โœ…
Prompt

write for me a python function that pulls data from a CSV file containing files that need to be deleted from S3 and that then deletes each file. Include error handling if a file cannot be deleted and return a list of all files that were and were not deleted. Also include suite of three test cases that ensure the function works, that errors are caught, and that the return value is two lists.

Response

As an AI language model, I don't have the capability to access files from your computer. However, I can provide you with a sample code that demonstrates how to delete files from S3 using the Boto3 library in Python.

    import boto3
    import csv

    def delete_files_from_s3(file_path):
        # Initialize S3 client
        s3 = boto3.client('s3')

        # Read the CSV file containing file names
        with open(file_path, 'r') as f:
            reader = csv.reader(f)
            files = list(reader)

        # Delete each file from S3
        deleted_files = []
        failed_files = []
        for file in files:
            try:
                s3.delete_object(Bucket='your-bucket-name', Key=file[0])
                deleted_files.append(file[0])
            except Exception as e:
                failed_files.append(file[0])
                print(f"Failed to delete {file[0]}: {e}")

        # Return the list of deleted and failed files
        return deleted_files, failed_files

The function takes the path of the CSV file containing file names as input. It reads the file using the csv module and deletes each file from S3 using the delete_object method of the Boto3 client. If a file cannot be deleted, it is added to the list of failed files and an error message is printed. The function returns two lists, one containing the names of deleted files and the other containing the names of failed files.

Here are three test cases to ensure that the function works correctly:

    # Test case 1: All files are deleted successfully
    deleted_files, failed_files = delete_files_from_s3('file_list.csv')
    assert len(deleted_files) == 5
    assert len(failed_files) == 0

    # Test case 2: Some files cannot be deleted
    deleted_files, failed_files = delete_files_from_s3('file_list_with_errors.csv')
    assert len(deleted_files) == 3
    assert len(failed_files) == 2

    # Test case 3: CSV file does not exist
    deleted_files, failed_files = delete_files_from_s3('nonexistent_file.csv')
    assert len(deleted_files) == 0
    assert len(failed_files) == 0

In the first test case, all files are deleted successfully and the function should return a list of 5 deleted files and an empty list of failed files. In the second test case, some files cannot be deleted and the function should return a list of 3 deleted files and a list of 2 failed files. In the third test case, the CSV file does not exist and the function should return empty lists for deleted and failed files.

The second test involved writing a simple Python function to clean up stray files in S3 using a list provided by a CSV file. ChatGPT scored pretty well here. It included the asked-for error handling and API interface, but its tests are not correct. The third test especially would crash when the file was opened, but the script does not account for that.

Once again I didn't run the code, but assuming the use of boto3 is anywhere close to the actual API, it was faster to have ChatGPT write the code than for me to do it.

Test 3: Two-Column Layout in React: โœ…
Prompt

write for me a JSX file using React that displays a two column layout with a list of appointments in the left column and the appointment details on the right columns. Use the react-bootstrap library for styling and no other libraries. Assume the list of appointments are passed into the component as props.

Response

Sure, here's an example of a JSX file using React that displays a two-column layout with a list of appointments on the left column and the appointment details on the right column, using the react-bootstrap library for styling:

import React from 'react';
import { Container, Row, Col, ListGroup, Card } from 'react-bootstrap';
    function AppointmentList({ appointments }) {
      return (
        <Container>
          <Row>
            <Col sm={4}>
              <ListGroup>
                {appointments.map((appointment) => (
                  <ListGroup.Item key={appointment.id}>
                    {appointment.title}
                  </ListGroup.Item>
                ))}
              </ListGroup>
            </Col>
            <Col sm={8}>
              <Card>
                <Card.Body>
                  <Card.Title>Appointment Details</Card.Title>
                  <Card.Subtitle className="mb-2 text-muted">Title</Card.Subtitle>
                  <Card.Text>
                    Lorem ipsum dolor sit ...
                  </Card.Text>
                  <Card.Subtitle className="mb-2 text-muted">Date</Card.Subtitle>
                  <Card.Text>
                    January 1, 2023
                  </Card.Text>
                  <Card.Subtitle className="mb-2 text-muted">Location</Card.Subtitle>
                  <Card.Text>
                    123 Main St, Anytown USA
                  </Card.Text>
                </Card.Body>
              </Card>
            </Col>
          </Row>
        </Container>
      );
    }

    export default AppointmentList;

Here, the AppointmentList component takes in a prop called appointments, which is an array of appointment objects. The left column displays the list of appointments using the ListGroup component from react-bootstrap, and the right column displays the appointment details using the Card component. You can customize the appearance of the list and the details as desired by modifying the styling properties of the components.

This test surprised me. I had ChatGPT create a two column layout in React for an appointment management application. Explaining a complex UI in words is difficult without visual aids, so I expected some misunderstandings, but it powered through and did exactly what I asked. It failed to add any navigation to the app nor did it use the data inside of the appointments array, so it's not really usable as a component, but it's certainly a good starting point and one I'd be happy to use as a starting template should I ever need such a thing.

That said, without tooling to make ChatGPT more available during development it would be easier to just write the layout myself.

Test 4: RSS Parsing in Swift: โœ…
Prompt

write for me a Swift RSS feed parser that takes in a string of XML data and produces a Post object with a title, description, pubdate, and enclosure fields. Use only the swift standard library

Response

Sure, here's an example Swift RSS feed parser that uses the Swift standard library to parse a string of XML data and produce a Post object with a title, description, pubdate, and enclosure fields:

Check out the code here. It's very long.

This last test was by far the most involved and open-ended. I asked ChatGPT for a Swift-based RSS Feed Parser and it certainly gave me something close. It used the correct Foundation APIs and even understood the need to concatenate the element text, but it failed to generate a valid test fixture (or even valid XML) and there's absolutely no error handling to speak of.

That said, it did produce valid XML once I called it out and there's something to be said for such humility. I would certainly use this code as a starting point if I needed to build something like this in the near future.

Should I Hire ChatGPT?

In general I'd say it performed fairly well as a developer, though its ability to imitate bloggers is very lacking. For the fifth test I tried to have it write this post, but the output didn't sound like me at all and it kept trying to sell itself using features it doesn't have. Overall I'd give ChatGPT a tentative recommendation and would probably hire it contingent of course on a 30-day probationary period to see if it can keep its tendency toward exaggeration in check.

It's Not an AI Apocalypse, It's Better

I don't really buy the idea that ChatGPT and its ilk will do much to disrupt our everyday lives in a dramatic way. I do however see both it and it's text-to-image cousins as being more and more useful as tools to automate away so much of the boring or tedious work of being a developer or a person on the internet in general.

Like I said, I already use Midjourney to create images for my D&D campaign and those images have had a significant impact in improving the gaming experience. We were never going to contract an artist for four once-a-week landscapes and so economically speaking the AI has had no external effect. Our D&D games just got marginally better. And that's great!

ChatGPT seems to me like it could be yet another advantage that enterprising developers would use to enhance their own productivity. If something like ChatGPT ever shipped inside of an IDE like Xcode, I could imagine a whole suite of amazing features (automatic complex refactors, automating test writing, and more). GitHub's Copilot does some of this, but it's in its infancy. In general I'd expect to see tools like ChatGPT improve a developer's productivity and let us focus more on the design and nuances of our code rather than on the tedious implementation; and for that I am very excited.

My Favorite Books From 2022

As I've mentioned before, 2022 was a watershed year for my reading capacity, and while it is probably a little late in the new year for a retrospective post, I did want to take some time and expressly call out, and recommend, a few of the books I read last year.

In no particular order, my favorite books last year were:

Never the Wind, Francesco Dimitri

This book was an absolute joy to read. It's a coming-of-age, ghost story set in nineties Italy, and it is just so well written and charming that I found myself spellbound by every page. Give this one a go if you're in the mood for some excellent fiction.

What Diplomats Do, Brian Sir Barder

This one I read for a yet-unannounced project I'm working on, and while I was hoping the book would be useful to me, I was not prepared for just how much fun it would be to work through. The author, a former U.K. Diplomat, spends as much time explaining the intricacies of overseas diplomacy as he does fictionalizing his time abroad and telling simply incredible stories about how and why certain diplomatic agreements were reached.

A Farewell to Arms, Earnest Hemingway

I read a lot of Hemingway last year, and this one was my favorite. A classic for a reason, and an excellent read. I did also like The Sun Also Rises.

The Matter of the Gods, Clifford Ando

This one, I'll admit, was a bit tough to get through. It's a treatise on Roman Religion, but it is written by and for historians and classical theologians. I picked this up after scouring the citations for one of my favorite blogs, and while the book assumes you've already read the ancient classics, and the medieval christian rebuttals to those texts, (which I have not) it was still an interesting read. Ancient mysticism is fascinating to me, and if the topic sounds enticing to you then I'd recommend skimming through this one. A deep read might be a bit too intense.

Existential Physics, Sabine Hossenfelder

Sabine is one of my favorite YouTubers, and her book is basically just more of the same. The book is a fun romp through many different parts of Theoretical Physics and both acts as a guide to what modern science can, and cannot, hope to explain. It's a good reminder, from the perspective of a physicist, that while science has given us the modern world, it cannot ever hope to solve some very important questions.

A Very Special Anniversary

Today marks the 10 year anniversary of the first post on this blog. It's been a wild ride writing for here, and I never would have predicted that after all this time I'd still be doing this.

For posterity, here are a few links that show how the site itself has evolved over the intervening years, though the site itself isn't really the most important thing to celebrate today.

Really today is special because it gives me the time to reflect on what writing for this blog has taught me. Since writing the first version of this blog I went from being a college student interested in programming to being a professional and independent software developer. In many ways I have achieved what I set out to do all those years ago, though of course not in the way I originally envisioned.

Blogging has been a truly transformational hobby for me. Like many people, I write to think. The process of making something —writing in this case— helps me solidify my own opinion on a topic and putting my thoughts to words helps me consolidate and organize them in a way that no other way does.

This blog has also served as an unofficial resumรฉ for me on several different occasions. I often tell people who are just starting out to set up a blog themselves. You don't have to build your own; you can just use Wordpress. But having a public presence filled with your own complex thoughts on a number of topics helps prospective employers understand your inner machinations. It shows them that you know how to think just like a resumรฉ would. My blog and public Github projects have gotten me just as far (if not further) than an actual resumรฉ.

More than that though, blogging here has given me a chance to get my thoughts out into the world. I'm incredibly fortunate that my writing is occasionally interesting to others and that a handful of my posts have gone micro-viral thanks to sites like Hacker News. To everyone who clicked on one of my posts: thank you. To all of you who actually read the post: thanks even more.

The internet continues to be a force we barely understand, but here I've gotten the chance to experiment, try things, fail, and get back up again. And I've tried to bring you all along with me as I've found out the answers to all sorts of questions.

Thank you all for reading, and here's to another ten years.