Skip to content

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

Notes on Locked Records in NetSuite

In NetSuite, records can be "locked". This is a special state that is poorly documented and introduces some very strange behavior. Hopefully, some of these notes save someone banging their head against the wall to solve this problem! Records can be locked in NetSuite in one of two ways: (1) the accounting period the transaction is in can be locked (2) or the record can be explicitly locked. You cannot determine if the accounting period is locked directly from the record. You’ll need to pull the associated AccountingPeriod posting_period object reference. You cannot "explicitly" lock a transaction in NetSuite via the API. I have not found a way to do this through the GUI either. A workflow can lock a record in NetSuite…

Continue Reading

Executing Multiple SQL Statements in Elixir

Working with raw SQL in the Elixir/Ecto world is not easy. I thought executing a multi-line SQL file in a database migration would be easy; it’s not. Here’s what I learned: The execute function does not support executing multiple statements at once. It’s perplexing that there’s no direct solution for this in Elixir. While AyeSQL claims raw SQL support, it mandates a one-statement-at-a-time approach. This limitation is particularly problematic when importing SQL designed to create triggers spanning multiple lines. For simple SQL tasks, you might consider splitting the raw SQL into multiple lines: But only if your SQL is well-formed and relatively simple…

Continue Reading