Update all globally installed npm packages at once

I keep meaning to run this but always forget the flag. There’s no npm update-all or anything – it’s just: npm update -g The -g tells npm to operate on the global package registry instead of the local node_modules. Without it, npm update only touches packages listed in your project’s package.json, which is the default behaviour and what you want most of the time. One thing to bear in mind: npm update won’t bump you to a new major version, even if one’s available. It respects the semver range in whatever pinned your package – so if you installed commander@2.x and 4.x is out, you’ll stay on 2.x. If you actually want to upgrade majors, you need to be explicit: ...

Import a Resource to a Terraform Module

Importing an existing AWS instance into a Terraform module is straightforward, but the syntax trips people up because you need to specify the full module path. terraform import module.foo.aws_instance.bar i-abcd1234 The format is module.<module_name>.<resource_type>.<resource_name>, followed by the resource ID. In this case, foo is the module name, aws_instance is the resource type, bar is the resource name inside that module, and i-abcd1234 is the AWS instance ID. Once imported, Terraform will manage the instance and track any configuration drift going forward.

'How much memory is actually free?'

I keep forgetting this one, so here it is. vmstat -s -SM | grep "free memory" | awk -F" " '{print$1}' It pipes vmstat output through grep and awk to pull just the number – no units, no labels, just the gigabytes sitting there doing nothing.