python3

Notes: Django w/ PostGIS on GCP Cloud Run and Github Actions

TL;DR: this a short post about the configuration steps I took to get django running with the GDAL extension and postgreSQL/postGIS backend. These notes are what it took to get it deployed on GCP Cloud Run, and to use Github Actions to run automated tests on push or pull request. Pretty straight forward, but I had to iterate a few times to get it right so hopefully this helps someone else.
Read more

YOLO-ing All the Traffic Cams

TL;DR - Here’s a web app to list labelled traffic cam images from the RI DOT website. I used YOLO (You Only Look Once) to detect objects (vehicles) in the images and FastAPI to serve the results to a React app. The displays the cam images and results and uses LeafletJS to display the cameras on a map. The backend is hosted on Railway and the front end on Github Pages.
Read more

New England Shipwreck Map

TL;DR - Here’s a list of shipwrecks plotted on an interactive map, all over the Narragansett Bay and greater New England area. Motivation At FarSounder I work on the development software of 3D Forward Looking Sonar products. Part of that development process of course includes collecting data from a lot of different situations and running it through some processing algorithms to evaluate performance and make improvements. To that end, we’re often out on the Narragansett Bay collecting data with the system, and always looking for areas in the bay with interesting features that we can use to test and benchmark our algorithms (pilings, super steep shoals, rock piles, piers, etc).
Read more

Shut the Box

TL;DR - choose either the option containing the largest number, or the fewest tiles and you’ll be ok! Read on to learn more… What am I talking about? Over the summer at a friends house, I was presented with an “old bar game” that I was completely unfamiliar with. It’s a wooden tray, with the numbers 1-12 printed in ascending order on little wooden tiles. Here’s an example of what it looks like:
Read more

Memoization in the Wild

Overview Memoization or memoisation is a method used to optimize programs. Usually, at least in my experience, it’s one of the first topics introduced when dynamic programming algorithms are being discussed. With a quick google search you can find the Wiki or a trillion other blogs about it - most will show the canonical example - the “hello world” of the topic - that is, using memoization to optimize a recursive implementation of a function that generates the n-th Fibonacci number (or sometimes a function computing factorials).
Read more

Computing Pi by Throwing Darts

In celebration of pi-day, let’s look at a method of computing pi using random numbers that is often presented in probability, statistics or other classes, as an elementary example of using random sampling and / or simulation. In my case, the first time I remember seeing / hearing about this example was in a probability class, however we didn’t actually write any code to try it, we just looked at the idea.
Read more

Switching to the Python Pathlib Module

It’s been about a year or so since we officially upgraded all of our tooling at my job at FarSounder from Python 2.7 to Python 3 (3.6 at the moment). Aside from the syntactic changes, there have been a handful of updates in Python 3 that I’ve found to really increase the readability of our scripts. One of those updates (from back in Python 3.4) has been the introduction of the pathlib module.
Read more