PowerBook G4

    I recently purchased a new MacBook Pro, and it gave me chance to reflect on the first Mac I owned: a 12-inch PowerBook G4 (nearly 20 years ago).

    The PowerBook remains one of my favourite laptop form-factors; incredibly compact back in 2003, and still with a full keyboard. It’s the first portable desktop-class computer I ever owned, with a playfulness and charm that I haven’t come across in a portable since1.

    Before letting it go a few years back, I took some photos that show off some of the MacBook’s fantastic details: the machined power button, interactive battery monitor, and screen latch, home to the ‘breathing’ sleep indicator was so characteristic of Apple portables of the time. I regret not giving it a better clean beforehand but, if you can get over that, I think they capture a fun piece of computing history.

    1. The 11.5-inch iPad Pro with Magic Keyboard comes close but, try as I might, I still find I need macOS for some of my everyday tasks. 

    Processing Packages

    Since shelter-in-place, we’ve been quarantining our mail and packages for a couple of days (there’s some evidence that the SARS-CoV-2 pathogen doesn’t survive for more than 2-3 days on surfaces). With a small San Francisco apartment however, it’s pretty difficult to keep things organised, and we kept losing track of when parcels had turned up, and when they were ‘safe’ to release.

    Determined to solve this in the most over-engineered (and expedient) way possible, I picked up the Adafruit IoT Pi Printer Project Pack and set about customising the software.

    The kit uses a Raspberry Pi and a small Python script, which was easy to modify to print a message giving a release date whenever the button is pressed. I also made use of Adafruit’s quotes API to add a little interest to each printout:

    Pressing the button prints a receipt that gives the release date and a quote

    Powering off a headless Raspberry Pi can be a little fiddly as there’s no way to invoke shutdown using a button with just the basic hardware. Adafruit’s solution is elegant: a long-press on the button prints a goodbye message and shuts the device down.

    Startup and shutdown is signalled by a custom printout

    Once we’re no longer quarantining mail, I plan to see what other things I can do with the printer–receipt printers are something I’ve been meaning to play with ever since Michael introduced me to Little Printer, and I’m excited to play around.

    Update: If you’re looking for the original laser cutter design files for the Adafruit kit, they can be found on Thingiverse.

    Developing with SSL

    Web development is something I do infrequently (it doesn’t feature in my day job), meaning some of the industry trends tend to pass me by. The restriction that some JavaScript client APIs are only available over HTTPS1 is one such trend I had missed.

    Encountering this restriction, I had assumed that it would be extremely difficult to set up HTTPS server locally for development. It turns out, however, it’s very easy using Flask (my go-to lightweight Python server of choice): simply passing ssl_context='adhoc' to the run method will dynamically generate, and use, an ad-hoc SSL certificate.

    if __name__ == '__main__':
        app.run(host='', ssl_context='adhoc', port=4443)

    1. For example, iOS requires this for accessing the accelerometer using device motion in Mobile Safari. Something I’ve been experimenting with for my 360° photo viewer.