Calculating elapsed minutes between LocalDateTime instances

There’s many ways to this, like getting epoch millis, calculating the difference and then converting back into the units you need. With java.time apis and java.time.temporal.ChronoUnit you can calculate the difference between 2 LocalDateTime instances easily in one step with:

long elapsedMins = ChronoUnit.MINUTES.between(start, end);

I was looking for a refresher on how to do this and found my own post from 3 years ago in a Google search here (funny when that happens).

Refresher: serverless framework local development workflow

It’s been a while since I’ve written any notes about the Serverless framework, so here’s a few notes as a refresher on typical steps I use for local development.

As a reminder to self, regions I typically deploy to are:

  • us-west-1 : SF
  • us-west-2: Oregon
  • eu-west-2: London

AWS regions are listed here.

To deploy:

serverless deploy --region eu-west-2

To invoke local:

serverless invoke local --function functionName

To invoke remotely:

serverless invoke --function functionName --region eu-west-2

To check logs from last invoke:

serverless logs --function functionName --region eu-west-2

Programming your Yaesu FT60 HT radio

I jotted down these notes a few years back to refer back to later. The trouble I’ve found with all HT radios is you work through the manual to setup a couple of local repeaters and then months (years!) go by and you can’t remember how you did it last time 🙂

Here’s my notes for setting up memories in your FT60:

To toggle freq VFO/memory mode:

  • bottom left button: V/M

To store current settings to a memory:

Set the current frequency, and for repeaters the offset, PL tone etc and then store all the currently selected settings to a memory:

  • hold bottom right FW
  • flashing mem is an empty slot
  • press bottom right (FW) again, stores in slot
  • switch to memory mode (toggle v/m button)
  • FW 0 selects menus
  • select 28 nm write, press FW to select
  • press FW again to select 1st char, rotate dial to select, up arrow to move to next char
  • if you get to last char it stores automatically, otherwise for less than max chars press ptr to enter to memory

To delete a memory:

  • go to memory mode, select memory
  • hold FW
  • select memory with knob
  • press hm/rv – deletes mem

Toggle memory freq display

In memory mode, press Band – toggles to freq & tune mode

Press again to toggle back to memories

Running MySQL in a Docker container on MacOS

It’s been a while since I’ve run MySQL server on my MacBook Pro (see past notes here , here and more here) and since I got my new M1 MBP I haven’t installed it yet. Rather than doing a native install, I want to run it as a Docker container so I can throw it away easily when I’m done.

Starting MySQL in a Container

From the MySQL Docker page, run:

docker run -p 3306:3306 --name mysql-springboot -e MYSQL_ROOT_PASSWORD=your-root-pass-here -d mysql

The important part here is -p to expose port 3306 in the container as 3306 on the host. This will allow you to connect to localhost:3306 locally to MySQL in the container as if it’s running locally.

Connecting with mysql shell locally

Connect with mysql shell as if the server is running locally:

mysqlsh -u root

and enter the password when prompted. Create a db and setup a user that you use from your app running locally:

create database example;
create user 'exampleuser' identified by 'examplepassword';
grant all on example.* to 'exampleuser'