Raspberry Pi USB Boot with JMS578 Based USB-to-SATA Enclosures

During the festive holiday period a part of one of the projects I have been working on involved moving my home automation setup from a Raspberry Pi 3B+ to a Raspberry Pi 4B 4GB. As part of this, I wanted to switch from using an SD card to booting from an SSD for improved performance.

I already had spare parts lying around which would be reused for this.

After using the Raspberry Pi Imager to provision the SSD with Raspberry Pi OS Lite, mounting the boot partition to add the ssh file, and connecting the enclosure to one of the USB 3 ports on the Pi it wouldn’t boot. After a bit of digging I found a workaround to get this working.

» Continue reading

Introducing toggl-summary-cli

toggl-summary-cli is a CLI utility, written in Typescript, for my own specific Toggl reporting requirements

I use Toggl Track for keeping track of what I am spending my time on while working. I’m not a contractor though, so I don’t have any hard requirement to ensure every minute of my day is accounted for. I do need to know though how many hours in a day or week that I have have been on the clock for reporting purposes.

This tool will, for a day or a week, report on:

  • booked time, the total for tasks
  • unbooked time, the total for unaccounted for time between tasks
  • total time, the sum of booked and unbooked time
  • break time, the sum of any times between a “marker” entry and the next task

In order to pick up on unbooked time and differentiate it from break time, I add entries with a tag of “marker”. This is used to indicate the start of a break. The break is determined to end when the next entry starts.


This uses commander.js for supporting command line arguments. Running the program with a -h or --help flag will print out the usage instructions. Note if you have a .env file as below this will include the values from that file in the output.

$ npx @devwithimagination/toggl-summary-cli -h
npx: installed 52 in 12.172s
Usage: toggl-summary-cli [options]

  -D, --debug                    output extra debugging
  --api-key <api-key>            api token, found in Toggle profile settings
  --email <email>                your email address
  --workspace-id <workspace id>  id of the Toggle workspace
  -d, --day <date>               day to report on (in yyyy-MM-dd format). If a date is not supplied then this will default to today. (default: "2020-09-21")
  -w, --week                     If specified, interpret the day as the start of a week.
  -h, --help                     display help for command

This uses dotenv for supporting loading secrets from a .env file in directory the tool is ran from. This is used to provide default values for the required CLI options above. This file can contain:

API_TOKEN=<api token, found in Toggle profile settings>
EMAIL=<your email address>
WORKSPACE_ID=<id of the Toggle workspace>

Example Usage

An example of running this for a single day:

$ npx @devwithimagination/toggl-summary-cli -d 2020-09-18
Report page loaded 1 total booked time: 02:49:13
==== Totals for 2020-09-18 to 2020-09-18 ====
Counted booked time: 02:49:11
Counted unbooked time: 00:54:20
Counted break time: 00:00:00
Counted total time: 03:43:31

Running for a week:

$ npx @devwithimagination/toggl-summary-cli -d 2020-09-14 -w
Report page loaded 1 total booked time: 28:22:01
Report page loaded 2 total booked time: 28:22:01
==== Totals for 2020-09-14 to 2020-09-20 ====
Counted booked time: 28:21:26
Counted unbooked time: 07:20:12
Counted break time: 04:01:59
Counted total time: 35:41:38

This might be no use to anybody but me, but it helps with my time tracking and that is what matters. If you are interested in the implementation, it is available on GitHub here.

Supplying Version Information to Sonarqube for NPM Projects

One of the optional Analysis Parameters for Sonarqube is the project version. For Maven projects this is automatically picked up from the pom.xml file, but this is not the case for NPM projects even though they have a version in the package.json file.

Running a scan with a manually supplied version number just requires an additional parameter to be supplied.

sonar-scanner -Dsonar.projectVersion=<version number>

There are many different approaches that can be taken to extract out the version number from the package.json file.

Using only node, this one-liner will work.

$ node -pe "require('./package.json').version"

If you have the fabulous jq installed this would also work.

$ cat package.json | jq -r .version

Once you have an approach that works for you, this can be setup as a script in the package.json file to save a bit of typing of commands later on. The latter approach, using jq is a little bit cleaner to do this with as it does not require escaping.

  "name": "open-apivisualiser",
  "version": "0.0.1",
  "scripts": {
    "sonar": "sonar-scanner -Dsonar.projectVersion=$(cat ./package.json | jq -r .version)"


Homebridge, Docker, and Wake-on-Lan

Continuing on from the previous post in this series, I have been doing a bit more investigation into solving the issues I was having with the homebridge-samsung-tizen plugin. All the features of the plugin were functioning as expected, with the exception of powering on the TV. This depends on Wake-on-Lan, which by default only works in the same network subnet, something which is not true unless the docker container is ran in host network mode. I have now found how to configure this to work.

» Continue reading

Publishing a Compodoc Site to Nexus

Recently I have been looking at Compodoc for generating documentation sites for Angular projects. Some of these projects are for libraries that will be reused elsewhere, so this documentation requires to be published somewhere.

The libraries are published as NPM modules to a Sonatype Nexus instance, so it would be ideal if the documentation could be published to the same place.

» Continue reading