Skip to content

Instantly share code, notes, and snippets.

View mikaelvesavuori's full-sized avatar

Mikael Vesavuori mikaelvesavuori

View GitHub Profile
@mikaelvesavuori
mikaelvesavuori / asyncapi3-request-reply-http.yml
Created December 20, 2023 09:52
AsyncAPI 3 request reply (HTTP) example.
asyncapi: 3.0.0
info:
title: Hello world using request/reply
version: 1.0.0
description: Hello world example using request/reply
channels:
hello:
address: /hello
messages:
@mikaelvesavuori
mikaelvesavuori / index.mjs
Last active December 18, 2023 09:12
Different ways to output IDs with Node.
/**
* @see https://medium.com/geekculture/the-wild-world-of-unique-identifiers-uuid-ulid-etc-17cfb2a38fce
* @see https://www.honeybadger.io/blog/uuids-and-ulids/
*
* Install with `npm init -y && npm install uuid nanoid ulidx -S`
*/
import { randomUUID } from 'crypto';
import { v4 } from 'uuid';
import { nanoid } from 'nanoid';
import { ulid } from 'ulidx';

Pay Transparency Card

Who am I?

Name

Naomi Nameson.

Contact email

@mikaelvesavuori
mikaelvesavuori / podman-cheatsheet.sh
Created December 3, 2023 15:52
Podman cheatsheet for common basic commands.
# Build and tag image
podman build -t <IMAGE>:<TAG> .
# List images
podman images
# List processes
podman ps
# Kill a process
@mikaelvesavuori
mikaelvesavuori / push-to-ttl.sh
Created December 3, 2023 15:51
Push a container image to ttl.sh using Podman
#!/bin/bash
########################################################################
# Uses Podman to build an image and push it to ttl.sh (https://ttl.sh) #
########################################################################
NAME=$(uuidgen | tr "[:upper:]" "[:lower:]")
echo "Image name is: ${NAME}"
@mikaelvesavuori
mikaelvesavuori / export.sh
Created October 30, 2023 06:05
Import and export spaces in Contentful.
#!/bin/bash
# See: https://www.contentful.com/developers/docs/tutorials/cli/import-and-export/
EXPORT_FOLDER="export"
EXPORT_FILE="backup.json"
SPACE_ID="YOUR_ID_HERE"
mkdir -p $EXPORT_FOLDER
@mikaelvesavuori
mikaelvesavuori / git-commands.sh
Created September 3, 2023 19:47
Various Git commands to inspect code.
git log -S <string>
git log -p <FILE>
git log --pretty --abbrev-commit — <FILE>
git log --pretty=format:"%h %ad %an - %s" --abbrev-commit -- <FILE>
git bisect start
git bisect bad
git bisect good
git bisect reset
@mikaelvesavuori
mikaelvesavuori / calculate-coupling.ts
Last active August 28, 2023 16:47
Calculate coupling metrics and aggregated metrics from TS files.
import { readFileSync, readdirSync, statSync, writeFileSync } from 'fs';
import path from 'path';
// Use this before running folder metrics
interface CouplingResult {
abstractions: number;
abstractness: number;
afferent: number;
concretions: number;
@mikaelvesavuori
mikaelvesavuori / notes.great-mental-models-1.md
Last active July 23, 2023 15:53
Book notes - "The Great Mental Models, volume 1: General Thinking Concepts" (Farnam Street)

Book notes - "The Great Mental Models, volume 1: General Thinking Concepts" (Farnam Street)

Concepts

The Map is not the territory

Maps and models are useful but influence in both directions: Both users and those making them. They should help us relate to the world.

Circle of Competence

@mikaelvesavuori
mikaelvesavuori / notes.continuous-architecture-in-practice.md
Last active July 23, 2023 09:08
Book notes - "Continuous Architecture in Practice" (Erder, Pureur, Woods)

Book notes - "Continuous Architecture in Practice" (Murat Erder, Pierre Pureur, Eoin Woods)

Page 9

Old approaches like XP did not scale well for software architecture, mostly ignoring quality attributes. The effect is teams get focused on features and constantly defer technical debt and technical features, such as quality attributes.

Page 13-14: Continuous Architecture Definition

What is Continuous Architecture? It is an architecture approach that follows six simple principles: