Update Global npm Packages

I rely on the amazing nvm library to maintain multiple, side-by-side major versions of Node.js to help me work with many different applications. I also use quite a few global CLI applications written in Node.js. These are typically installed with this command:

1
npm install --global <package-name>

To update these globally installed packages, I used to rely on this manual workflow:

  1. List the globally installed packages using npm ls --global --depth=0
  2. Copy paste the names of all the packages from the output of the above command to install them again - like npm install --global <package-1> <package-2> ... <package-n>

Since I found myself doing this every few days, and that too, for every side-by-side version of Node.js I have on my machine, I decided to spend some time today to convert this into a one-liner command (which I can then add as an alias into my .zshrc file).

Since I also have the awesome jq utility installed on my machine, this is what I have come up with:

1
npm ls --global --json --depth=0 | jq --raw-output '.dependencies | keys | join(" ")' | xargs npm install --global

Generate Python, Java, and .NET software libraries from a TypeScript source

Cross-posted from the AWS Open Source Blog article that I authored.

As builders and developers, many of us are aware of the principle of Don’t Repeat Yourself (or DRY) and practice it every day. Entire runtimes and programming languages have been developed by taking that principle to an even higher level, with the core idea of writing software once and having it run on many different platforms, hardware, and operating systems. In this post, I explore the possibility of authoring and curating a software library in the TypeScript language, which at build time can then be generated into libraries in multiple other programming languages such as Python, Java, and .NET/C#. This is made possible by an open source software framework developed by AWS called jsii, one of the core architectural components in the AWS Cloud Development Kit (AWS CDK).

Read More…

DIY Smart-Garage with Raspberry Pi

Summary

We have a detached garage that opens into the alley behind our home and it has always been difficult to quickly tell from within the house if the garage door is currently open or closed. And this is something that I really wanted to fix with some sort of DIY hacks, right from the very first day we started living in our home.

Sometime in early March, the garage door began having another problem - closing it with one of the remotes or with the wall-switch begins with the closing, but immediately stops and backs out after closing a few inches. I later diagnosed this to be an issue with misaligned/dirty sensors and have rectified it.

But that problem energized my desire to start a DIY project to convert my plain old, “builder quality” garage door opener (which is Chamberlain HD400DM) to a “smart one“.

Read More…

Spring!

Spring is here!
The flowers are blooming
The grasses are glowing
The birds are singing
The bees are buzzing
The butterflies are fluttering
There are seasons, the seasons travel
They come around, around, around

- Maya Haridas

Second poem by Maya

🌱 🍄 🌷 🌼 🌸 🌺 💐