Skip to content

Instantly share code, notes, and snippets.

View mikaelvesavuori's full-sized avatar

Mikael Vesavuori mikaelvesavuori

View GitHub Profile
@mikaelvesavuori
mikaelvesavuori / well-architected-lens.template.json
Created May 13, 2024 11:40
AWS Well-Architected Lens template.
{
"schemaVersion": "2021-11-01",
"name": "Replace with lens name",
"description": "Replace with your description",
"pillars": [
{
"id": "pillar_id_1",
"name": "Pillar 1",
"questions": [
{
@mikaelvesavuori
mikaelvesavuori / clone-org-repos.sh
Created May 13, 2024 11:40
Clone all repositories belonging to a GitHub organization.
#!/bin/bash
GITHUB_TOKEN="your_access_token"
ORG_NAME="your_organization"
PAGE=1
function updateCloneUrlList() {
rm repos.txt
while true; do
@mikaelvesavuori
mikaelvesavuori / ulid.mjs
Created May 9, 2024 08:36
Example of ULID to replace timestamps.
import { ulid, decodeTime } from 'ulidx';
const timestamp = () => parseInt(Date.now().toString());
const time = timestamp();
const ulidTime = ulid(time);
console.log('timestamp', time);
console.log('ulid', ulidTime);
console.log('ulid timestamp', decodeTime(ulidTime));
@mikaelvesavuori
mikaelvesavuori / keylistGenerator.ts
Created April 22, 2024 10:06
A keylist generator that can produce 1000 conflict-free keys in less than 3200 bytes.
export function keylistGenerator() {
const bytes = (str: string) => new Blob([str]).size;
const newId = () => randomBytes(3).toString('hex');
//const newId = () => randomBytes(5).toString('base64').substring(0, 6);
function generateIdString() {
const keylist: string[] = [];
let generatedIds = 0;
@mikaelvesavuori
mikaelvesavuori / createFileInGithub.ts
Last active April 22, 2024 05:42
Helpful GitHub API functionality for Node.
import { getBlobShaFromGithub } from './getBlobShaFromGithub';
export async function createFileInGithub(input: string, fileName: string, type: string) {
const owner = process.env.OWNER;
const repo = process.env.REPO;
const workflowId = process.env.WORKFLOW_ID;
const token = process.env.GITHUB_TOKEN;
if (!owner || !repo || !workflowId || !token)
throw new Error('Missing required environment variables!');
@mikaelvesavuori
mikaelvesavuori / prompting-examples.md
Created January 17, 2024 13:50
Prompting examples

Prompting demos

Zero-shot prompting

Give me a name for an article about microservices on AWS.

Example output:

@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