Skip to content

Automatically Download and Rename Your LabCorp PDFs

Over the last couple of years, I’ve incrementally tried to improve my understanding of my health. Part of this is understanding my lab work and collecting the data in a way that I can personally understand and analyze it. In order to do this, I needed to download all of my past LabCorp PDFs. My goal in downloading these PDFs is to funnel them into my custom GPT, which will extract the results into a nicely formatted CSV that I can then copy and paste into Google Sheets. This enables me to easily graph, chart, and otherwise analyze my blood work results. Given the lack of a straightforward way to download all PDFs from the LabCorp website, I created scripts to automate the downloading and renaming of the PDFs for easier analysis and storage…

Continue Reading

How to Inject Custom Code on Python Interpreter Startup

Ruby and Javascript both allow you to execute arbitrary code before your main application runs without modifying your application code. My most common use case is executing monkey patches to make it easier to debug an application. However, this is not possible with Python. This makes using development tools like pretty-traceback challenging. In my case, I work across a bunch of reports, and injecting six lines of Python into each repo is annoying (especially since many open-source repos don’t have a concept of a PYTHON_ENV, so there’s not an easy way to disable it in prod). The Magic .pth File In any engineering discipline, the more you understand the entire stack you are working with, the faster you’ll be able to fix issues…

Continue Reading

Fixing Broken Ethernet on Orange Pi 3B

I attempted to get my Orange Pi running as a tail-scale exit node. To do this, I had to enable IPv6 on the device. I ran the commands to enable the IPv6 connection, but it didn’t seem to work, so I rebooted the Orange Pi. After rebooting the Pi, the Ethernet would not connect. I ended up having to plug a screen into the orange Pi and wasted a bunch of time trying to understand why the Ethernet connection wasn’t working. I eventually ran into this blog post which indicated that there’s some low level memory issue with a recent firmware upgrade which broke the Ethernet device on the orange Pi. Super dissapointing! Here’s how to fix the ethernet across reboots…

Continue Reading

AppleScript Tips: Inspecting Objects, Modal Dialogs, and More

AppleScript is an amazing, quirky tool within the macOS ecosystem. It enables you to control any application on your Mac, even if the original developer didn’t explicitly write an API for it. This can be incredibly useful when attempting to automate certain actions. However, the language is incredibly weird and confusing, especially to a "real" software developer. I’ve compiled a list of tips and tricks below that help me write various tools and scripts to automate my computer (I’ve written about applescript before in case you are looking for other tricks)…

Continue Reading

Using the Multiprocess Library in Python 3

Python has a nifty multiprocessing library which comes with a lot of helpful abstractions. However, as with concurrent programming in most languages, there are lots of footguns. Here some of the gotchas I ran into: Logging does not work as you’d expect. Global state associated with your logger will be wiped out, although if you’ve already defined a logger variable it will continue to reference the same object from the parent process. It seems like the easiest solution for logging is to setup a new file-based logger in the child process. If you can’t do this, you’ll need to implement some sort of message queue logging which sounds terrible. Relatedly, be careful about using any database connections, file handles, etc in a forked process…

Continue Reading

Building a Crypto Index Bot and Learning Python

A long time ago, I was contracted to build a MacOS application using PyObjc. It was a neat little app that controlled the background music at high-end bars around London. That was the last time I used python (early 2.0 days if I remember properly). Since then, python has become the language of choice for ML/AI/data science and has grown to be the 2nd most popular language. I’ve been wanting to brush up on my python knowledge and explore the language and community. Building a bot to buy a cryptocurrency index was the perfect learning project, especially since there was a bunch of existing code on GitHub doing similar things. You can view the final crypto index bot project here. The notes from this learning project are below…

Continue Reading

How to install an old HomeBrew package

I accidentally ran brew upgrade on a set of packages which caused brew to bump most library packages that were installed on my computer. This caused issues compiling PHP via asdf. I thought it would be easy to install an older version of the offending package, icu4c, but I was very wrong. In recent (2021?) versions of brew. I ended up learning a bit about the homebrew internals and solving Installing an old version of icu4c to fix PHP compilation on macOS I discovered the offending package was icu4c, but the PHP compile script did not indicate that I was using an unsupported package version…

Continue Reading

Scripting macOS with Javascript Automation

I’ve been playing with ActivityWatch, a really neat open-source application to track what you are doing when you are on your computer. Similar to rescue time RescueTime, but open source, with some more advanced features. I’ve been using it for a couple of months as part of my digital minimalism toolkit and it’s worked great to give me an idea of what’s taking up my time. There’s been a couple of things that have bugged me about the application, and it’s written in a couple of languages I’ve wanted to learn (Rust, Vue), so I decided to make a couple of changes as part of a learning project. I ended up needing to modify an AppleScript and ran into macOS’s Javascript Automation for the first time…

Continue Reading

Migrating from bash to zsh

I love productivity tools. Anyone who works with me knows I love my keyboard shortcuts and tiny productivity hacks. Small, incremental productivity improvements add up over time: feeling fast makes you fast. Plus, I just enjoy tinkering and making things more productive. One of the rabbit holes I love to go down is optimizing my development environment. I spend a lot of time in a terminal, so it’s a fun place to optimize my setup. Ever since hearing of Oh My ZSH I wanted to try out zsh, so I set aside some time to update my dotfiles to use zsh as the default shell. Below are some notes & learnings from the transition. What’s new in zsh? There are lots of small packages out there for neat things like autocomplete, async prompts, etc…

Continue Reading

Dumping a AWS RDS Database to Your Local Machine

I’m a big Heroku fan. I used it’s hosted Redis and Postgres services for my startup and it scaled incredibly well and saved me a ton of time not having to ever worry about devops. One of things I loved about Heroku was it’s CLI API. You could very easily manage infrastructure through a very thoughtful CLI. For instance, a common process I would run was: Dump production database to my local Import the dump into my local Postgres Clean & sanitize the data This process looked something like: That first line was all you needed to download a production copy of your DB. I’ve been playing around with AWS for a side project and replicating a similar process was surprisingly challenging…

Continue Reading