Skip to content

Choosing the right Ubuntu AMI for EC2

As part of setting up an app on an EC2 instance on AWS I wanted to try out Amazon Linux. Picking the latest compatible Amazon Linux AMI using CDK is easy: However, Amazon Linux isn’t always the right choice. What is Amazon Linux? It’s not Ubuntu, it’s Fedora (also, Amazon Linux 2 is older than 2023): Why? I have no idea. I’ve done a lot of random stuff in my time as a developer, and running into Fedora is not one of them. When I ran my ansible scripts against the gravitron fedora box it immediately failed: I was attempting to use ansible-dokku with Amazon Linux 2023, which explicitly is not supported. Gravitron-supported OS are listed here and included Ubuntu, so it was time to use an Unbuntu image…

Continue Reading

Archiving Videos from Amazon Photos

Amazon Photos is a good-enough product for video storage. The interface is pretty bad, they don’t have an API, they don’t add new features, but they have unlimited photo storage with Prime, their mobile backup app is decent, and they have easy photo printing options. However, they do not make it easy to bulk download photos or videos. These two scripts, which you can copy/paste into your web console, make it easy to "select all" on a specific filter and download your videos + photos from Amazon Photos. Select all photos or videos to download It’s frustrating, but Amazon Photos does not allow you to "select all" when you are looking at a filtered set of photos or videos…

Continue Reading

Converting a Node Project from CommonJS to ESM

I had a small JavaScript project (deployed via AWS lambda, which I’ll write about later on). I needed to add a very simple package to the project—detect-cloudflare—which sent me down a deep rabbit hole: My project was written years ago using CommonJS (i.e. require). cloudflare-detect included a bunch of packages for a very simple task, which bothers me. Plus, the IP address ranges were out of date and the package hadn’t been updated in years, I decided I wanted to update it. Should be easy, right? (this is never a good thing for an engineer to say) I updated the project and got all of the tests passing without too much effort. Nice! When I went to use the newly refactored package in my project it failed with this error. Uh oh…

Continue Reading

Using Ansible to Setup Custom Dotfiles

A while back I posted about using Ansible for an Elixir application. I recently wanted to update this application and add a couple of new features: Add my dotfiles to the server in a similar way to GitHub codespaces (using this role) Add brew, mostly for my dotfiles to work Automate more of the dokku-based setup Here’s the heavily commented ansible config for a dokku-based application (not specific to Elixir): Ansible learnings Some additional learnings this time around: lookup('env','HOME') is the directory of the environment that ansible is executed from, i.e. your computer directory. Same goes with lookup('file', '~/something')…

Continue Reading

Passing Environments Variables to EC2 Instances using AWS CDK

I was updating an older project that ran using dokku and hosted an Elixir/Phoenix application with a postgres database. Uptime and other normally important things didn’t matter, so I just wanted to host the database and application on a small EC2 instance. However, the application got complex enough (SQS queues, some lambdas, etc) that I wanted to pass the SQS endpoints automatically to the EC2 instances via environments. Should be easy, right? This feels like a very common use case. I struggled to find a solution to this problem that Just Worked…

Continue Reading

Deploying Nodejs on AWS Lambda using NodejsFunction

I wanted to deploy a node lambda on AWS using CDK. The NodejsFunction seemed like an improvement over using the standard Function construct: the CDK SDK would bundle your code for you, in a docker container running the same version of node used in the lambda. Instead of defining a code param you define an entry file that is used for the compilation process. This seems like a great improvement over copy/pasting your local nodejs application (including the local node_modules!) into the lambda…

Continue Reading

Automating Elixir Package Deployment with GitHub Actions

I enjoy Elixir, although I know it doesn’t make sense to use it for most production applications. However, I try to use it for side projects when I can, even just because it’s such a fun and beautiful language to program in. One thing I’ve been fascinated with recently is automating the entire release process for packages using conventional commits with GitHub actions. This post walks through how to make that happen, and some other bits around Elixir project setup. Here’s the example project with all of the learnings from this post in place…

Continue Reading

Aggregating Data by Month in Google Sheets

Certain operations that are easy in SQL are hard in google sheets / excel. I ran into one of these: I had a simple problem: I had some time series data (dividend payouts from a financial institution) and I wanted to aggregate the data by month. In SQL, this is a simple GROUP BY, in sheets it’s not that easy. Create a separate sheet to aggregate data, then group Filter based on the type of transaction Look at each date and normalize it to the last day of the month =ARRAYFORMULA(EOMONTH(B:B, 0)) (this is now column E) Get a list of unique months (i.e…

Continue Reading

Re-learning Modern PHP

A while back, I ran into Monica (a sort of fancy address book). I started to use and self-host the project as part of tinkering with my raspberry pi and then wanted to make a couple of improvements to the project. This was a good excuse to explore the PHP world and see how things have evolved since I touched the language over a decade ago. I’m surprised to say this, but working with PHP was not nearly as painful as I thought it would be. The language and tooling have evolved nicely over the years. If I was forced to use PHP as my daily driver, I wouldn’t be too disappointed!..

Continue Reading

Download a CSV of Wealthfront Financial Activity

I use Wealthfront for a portion of my investments. I recently was trying to get a CSV of all my dividends, fees, etc this year and there’s not a way to do this! If you navigate to your activity (homepage > investment account > see recent activity) you can at least generate a CSV from the information on-screen (which does not include your gains/losses from the direct indexing) and copy/paste this into your web console, your browser will spit out a CSV. This is highly tied to the current (as of this writing) Wealthfront HTML structure, so you’ll probably have to ask ChatGPT to fix this in some number of months…

Continue Reading