Weeknotes 32
6th February, 2022
“What, a Pushover?”
-
I recommended TRex recently for OCRing on-screen text. I also recommended CleanShot X for all your screenshot needs. Well, CleanShot now has support for capturing text via OCR, so I only need CleanShot now - one less thing in the menubar.
-
Speaking of Fly, I’m currently working on a side project using Elixir and Phoenix and needed somewhere to deploy it. I’d been hearing good things about them for a while so decided to give it a try. They also recently announced that they would start offering free Postgres which certainly doesn’t hurt.
The deployment process was really good overall.
I had trouble with
node-sass
(as everyone on the Internet does) so I moved todart-sass
instead which is doesn’t require compiling anything to work. This wasn’t Fly’s fault, I’ve had problems withnode-sass
many times.Once I got the app fully deployed I encountered a more serious issue with the VM running out of memory.
I connected to the VM using
fly ssh console
and then started aniex
session so that I could create some test users in the database. Whenever I did soiex
would get killed - very strange. Later I realised that the BEAM would get killed whenever I logged in via the web too. What is common between these two actions? Password hashing!I posted on Fly’s community forum for help, and Chris McCord himself replied but it wasn’t clear what was happening. I later found the solution on the Elixir Forum. Turns out that Argon2 is very memory expensive by default. So every time I was hashing a password it would use a lot of memory and bloat the process pushing it over the allowed limits.
Some configuration and all it now well.
# config/prod.exs # Set cost of password hashing complexity to use less memory config :argon2_elixir, t_cost: 2, m_cost: 15 # ~60ms
Fly has been really good so far in my limited experience.
-
Pin your Node version in
package.json
, especially when deploying to Heroku, in case, hypothetically, they bump the Node version and your build fails and you can’t deploy to production. Hypothetically. -
A colleague was debugging a Heroku build issue and put together a quick
Dockerfile
using the base image supplied by Heroku. It hadn’t occurred to me that Heroku Stacks were available as Docker images. Pushing to Heroku over and over to diagnose an issue gets old fast so this approach is welcome. -
No capes: the perils of being a hero-engineer
when you show up to a new job where there’s a hero (or group of heroes) jumping in to fix things constantly, it’s frustratingly slow to understand how everything fits together from the outside. There’s hints dropped in Slack and breadcrumbs in pull requests but all the discussion has happened in a private chat elsewhere.
I’ve experienced this. It made me feel like I couldn’t contribute because the hero always got there first - not a healthy culture. And what happens when your hero leaves?
-
An interesting take on a JavaScript programmer coming to Rails
…coming from the current Javascript ecosystem makes discovering Rails a revelation
-
lol 😆
Facebook’s stock stayed down all day, wiping $200 billion in value from the company’s market cap — the biggest one-day drop in market value ever. Couldn’t happen to a nicer company.
-
Rust returns! Again. I’ve picked a project to implement in Rust now. Something small enough in scope that it doesn’t overwhelm, but significant enough to not be a complete toy.
I’m writing a command line app to send notifications using the Pushover API, something that I’m sure already exists, but that I personally have a requirement for, which is a nice way to scratch my own itch.
I’ve got something that works already, which is great, but there is a lot of tidy up, and many improvements to be made.
Learning new languages means more than just syntax. You also have to acquaint yourself with how the community operates, the idioms of the language, the approach to testing — myriad topics.
One of those topics is error handling. Rust’s error handling is, from what I understand, one of it’s unique features, but very different to what I’m used to. This article was very helpful during the learning process.
I need to remember that Rust is a big language with many ideas completely foreign to me, and I don’t need to know it all right now.
Like lots of Rust features, it’s error handling approach makes me feel confident that the program I’m writing will work at runtime. Ruby has lots of great qualities, but that is not one of them for me.