Skip to content

Instantly share code, notes, and snippets.

View coderbyheart's full-sized avatar
🌩️
building serverless IoT solutions

Markus Tacker coderbyheart

🌩️
building serverless IoT solutions
View GitHub Profile

Show the time to your next Outlook meeting in your zsh prompt

Adds a countdown like this to your zsh prompt:

(next meeting: 15:30, in 1h25m)

It only shows up when a meeting starts within the next 4 hours. It's green normally, yellow under 15 minutes and red under 5 minutes.

@coderbyheart
coderbyheart / wipe-tables.ts
Created June 1, 2026 07:51
wipe-tables.ts
/**
* Wipes all items from every DynamoDB table whose name starts with the given
* prefix.
*
* Lists all tables in the account, keeps the ones matching the prefix, and for
* each one scans every item (projecting only the key attributes) and deletes
* them in batches of 25 via `BatchWriteItem`. Tables with deletion protection
* enabled are skipped. The table itself is left in place — only its contents
* are removed.
*
@coderbyheart
coderbyheart / npm-publish-preview.ts
Last active August 14, 2026 13:50
Publish a pre-release ("dev") version to NPM.
/*
* Publish a pre-release ("dev") version to NPM.
*
* Computes the next dev version as `<next-target>-dev.<n>`, where:
* - <next-target> is the latest published stable version with either the
* minor or the major bumped by one and lower components reset to 0
* (e.g. `14.0.4` → `14.1.0` for a minor bump, or `14.0.4` → `15.0.0`
* for a major bump). The bump kind is controlled by the `--major` flag;
* the default is a minor bump.
* - <n> is one greater than the highest existing dev counter for
@coderbyheart
coderbyheart / .zshrc
Last active June 12, 2025 13:57
ts alias (run TypeScript in Node.js)
alias ts='f() { node --experimental-transform-types --no-warnings $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} ${11} ${12} ${13} ${14} ${15} ${16} ${17} ${18} ${19} ${20} };f'
@coderbyheart
coderbyheart / convert-imports.js
Last active February 10, 2025 10:11
Migrate from TSX to native Node.js TypeScript running
import fs from 'node:fs'
import path, { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
const __dirname = dirname(fileURLToPath(import.meta.url))
console.log(__dirname) // Outputs: /absolute/path/to/directory
const updateImports = (directory) =>
fs.readdirSync(directory).forEach((file) => {
const filePath = path.join(directory, file)
@coderbyheart
coderbyheart / all.sh
Last active July 14, 2024 13:03
Clone all repos of a GitHub organization
curl -s https://api.github.com/orgs/bifravst/repos\?per_page\=200 | jq '.[] | select( .archived == false).clone_url' -r | xargs -I@ git clone --depth 1 @
@coderbyheart
coderbyheart / aws-iot-encode-binary.md
Created April 25, 2024 10:35
Encoding binary in AWS IoT Shadow

Meta data

{
  "myBinaryPayload": "7483c2f64e8f085b",
  "myBinaryPayload:coap-content-format": 42
}

Encode as object

@coderbyheart
coderbyheart / README.md
Last active April 8, 2024 08:37
Broken ESM Lambda when folder exists with same name as handler module

When a lambda is authored with this structure:

acme.js
acme/lib.js

and the acme.js imports from acme/lib.js it breaks:

@coderbyheart
coderbyheart / notes.txt
Created April 2, 2024 15:18
FroGSConf 23 March 2024 - How to find employers that value quality (and you)?
Who is interviewing you? Do you talk to the people you'd be working with everyday?
Does someone else you know have insider information before a formal interview?
Why do you need this role? How is this competency covered in the org at the moment?
What is the current mindset of the team?
How is a team formed? Do we all win together?
What's the salary like?
What are people's typical hours? What is it like when you get close to a deadline?
Check out Glassdoor reviews (but keep in mind it can be anecdotal)
What's difficult about the current situation?
Are you expected to be in the office, have your camera on?
@coderbyheart
coderbyheart / fetch.js
Last active March 7, 2024 11:41
Kartverket API for vasstandsdata
import { xml2json } from "xml-js";
const station = async ({ latitude, longitude }) => {
const req = `https://api.sehavniva.no/tideapi.php?${new URLSearchParams({
lat: latitude,
lon: longitude,
datatype: "obs",
refcode: "cd",
interval: 60,
dst: 0,