TL;DR - Misc notes from the 2024 Advent of Code in Python and Ocaml and a little bit of Golang.
The repo with my solutions to the Advent of Code 2024 problems can be found here. This is a bunch of random notes from this year’s event, no full write-ups or anything for now just general notes and take-aways.
Languages Learned a bunch of Ocaml (even though I didn’t use it everyday as intended)
TL;DR - For newdepths.xyz I wanted to add a simpler way for users to log in, in that way they can avoid creating a new password just for this little site. I also wanted to implement all the parts of the flow to get a good feel for them and how they fit together. Of course there are a lot of libraries that handle this well, but I think that doing it manually with low stakes is a great way to learn how everything fits together.
TL;DR: In a recent camping trip we noticed just how cold our propane tank was getting after cooking for a while - we started out pretty chilly anyway (about 50 F). The physics of this is cool and I wanted to play with modeling it.
I have one of these little two burner propane stoves that we use when camping, it looks something like this:
While we were cooking breakfast and boiling water for coffee, we noticed that the propane tank was getting super cold - there was not only a thick layer of frost forming on the outside, but a small chunk of solid ice on the bottom of the tank where it met the picnic table…
TL;DR: A quick “non-mathematical” introduction to the most basic forms of gradient descent and Newton-Raphson methods to solve optimization problems involving functions of more than one variable. We also look at the Lagrange Multiplier method to solve optimization problems subject to constraints (and what the resulting system of nonlinear equations looks like, eg what we could apply Newton-Raphson to, etc).
Introduction Optimization problems are everywhere in engineering and science. If you can model your problem in a way that can write down some function that should be minimized or maximized (the objective function) to get the solution you want, even in cases where there is no analytical solution (most real cases), you can often obtain a numerical solution.
TL;DR: The S63 encryption scheme is old and can be broken pretty easily depending on the information you have. These are some notes on how with a simple Python script to show what I mean.
So this is an old standard that will soon be replaced by S100, but it’s still in place and used today. The encryption part of the scheme is mostly to allow data suppliers to license their data to users in a standardized way and collected payment for access to that data.
TL;DR: S-63 is a standard used to encrypt official Electronic Navigational Charts (ENCs). Encryption and signing allow clients to be sure that they have official data and that it has not been tampered with. It also make it possible for data providers to license sections of the charts (cells) and be sure that they are not being shared illegally / pirated. This post gives an overview of the process and shows how to implement the key steps.
Newton’s method is a root-finding algorithm that can be used to find the roots of differentiable functions. It is a very simple algorithm to implement, and it converges quickly in most cases, of course depending on the function. It is often used to find the roots of polynomials. For instance, in Chemical Engineering properties calculations, often cubic equations of state are used to model the behavior of fluids. These equations of state are cubic polynomials and most solved for their roots in most cases in order to compute fluid properties and phase equilibria.
TL;DR: Use the script below to add captions from a .srt file to a Camtasia 2023 project as callouts so they can be edited and styled.
The script is available on GitHub. The Camtasia project file is just a JSON file, so this parses the captions from the .srt file and adds them to the project file as callouts.
Not intended to produce polished captions, but rather to get the captions into the project so they can be edited and styled - basically as a time saver for the initial captioning process.
TL;DR: Use the functions in the random module for modeling, simulations, games, sampling, etc. but use os.urandom, secrets, or random.SystemRandom for cryptographic applications. I know very little about cryptography and security, these are just my notes about stuff I recently learned.
It uses the Mersenne Twister algorithm, which is a pseudorandom number generator with a period of 2^19937-1. It is one of the most widely used PRNGs in the world, and suitable for many applications.
TL;DR - Monte Carlo Simulation can be used to model your historical sales pipeline data to account for some of the randomness and uncertainty in the sales process. In this post, Monte Carlo Simulation is introduced and then applied to the same case introduced in a previous post.
What is Monte Carlo Simulation? Monte Carlo Simulation is used to simulate a process using random sampling. It is a very general technique that can be used to model all kinds of processes in fields ranging from physics and chemistry, to economics and finance.