Skip to content

Instantly share code, notes, and snippets.

View Integralist's full-sized avatar
🎯
Making an impact

Mark McDonnell Integralist

🎯
Making an impact
View GitHub Profile
@Integralist
Integralist / hunk-ignore-files.bash
Last active October 28, 2026 11:06
hunk ignore files
# ignore changes to the local .agents/ and docs/ directories + ignore *.lock files
hunk diff -- . ':!.agents' ':!docs/' ':!*.lock'
# https://www.hunk.dev/
# https://github.com/modem-dev/hunk
@Integralist
Integralist / synctest example.md
Created October 21, 2026 14:22
Go synctest example

Here is an example with two concurrent background workers sleeping for different durations, observed by the main test goroutine.

package worker_test

import (
	"testing"
	"testing/synctest"
	"time"
)
@Integralist
Integralist / cd-rip.sh
Created October 16, 2026 14:11
CD Rip
mkdir -p ~/Music/Dusk_And_Her_Embrace && for f in "/Volumes/Dusk... And Her Embrace/"*.aiff; do ffmpeg -i "$f" -c:a flac -compression_level 12 ~/Music/Dusk_And_Her_Embrace/"$(basename "${f%.aiff}").flac"; done
@Integralist
Integralist / Mermaid Diagrams CLI.sh
Created August 28, 2026 13:23
Mermaid Diagrams CLI
npm install --global @mermaid-js/mermaid-cli
# -s is the scale (i.e. larger dimensions)
mmdc -i input.mmd -o output.png -b white -s 2
@Integralist
Integralist / Common Table Expressions.md
Last active June 10, 2026 09:23
MySQL Database: Core Fundamentals & Common Gotchas

Common Table Expressions

A Common Table Expression (CTE) in MySQL is a temporary result set that you can reference within a SELECT, INSERT, UPDATE, or DELETE statement.

Think of it as a temporary view that exists only for the duration of that single query. It allows you to write cleaner, more readable SQL by breaking down complex queries into smaller, modular building blocks.

CTEs were introduced in MySQL 8.0, so you will need that version or higher to use them.

The Basic Syntax

@Integralist
Integralist / Kubernetes Probes.md
Created June 1, 2026 16:44
Kubernetes Probes
  • livenessProbe: tells Kubernetes whether the container is still alive. If it fails repeatedly, Kubernetes restarts the container.
  • readinessProbe: tells Kubernetes whether the container is ready to receive traffic. If it fails, the pod stays running but is removed from Service load balancing.
  • startupProbe: tells Kubernetes whether the app has finished starting up. While it is still failing, Kubernetes suppresses liveness/readiness handling for slow-starting apps.

Typical behavior:

  • Use livenessProbe to detect deadlocks/hung processes.
  • Use readinessProbe to gate traffic until dependencies/init work are done.
  • Use startupProbe when startup is slow and you don’t want liveness to kill the app too early.

Simple mental model:

@Integralist
Integralist / go-test-flags-summary.md
Last active May 24, 2026 13:26
Go: Discoverable Test Config in Go with Flags (rednafi.com)

Discoverable Test Config in Go: Use Flags

Summary of rednafi.com/go/test-config-with-flags.

The article compares three ways to toggle tests in Go (snapshot, integration, real-vs-mock) and argues for custom flags.

1. Build tags — discouraged

//go:build snapshot
@Integralist
Integralist / go-shebang-summary.md
Last active May 24, 2026 13:17
Go 'shebang' trick — running .go files as scripts

Go "Shebang": Running Go Files as Scripts

Summary of lorentz.app: go-shebang by Lorentz Kinde (2025-12).

The trick

Prepend this line to a .go file, chmod +x, then run it directly:

//usr/local/go/bin/go run "$0" "$@"; exit
@Integralist
Integralist / Writing Guidelines.md
Created April 18, 2026 19:18
Writing Guidelines

Documentation Principles & Best Practices

The primary goal of documentation is to reduce friction for the reader. While the best starting point is simply ensuring a README.md exists, adhering to the following pillars will significantly improve the quality and longevity of your technical writing.

  1. Prioritize Brevity and Professionalism
  • Be Concise: Value the reader’s time. Use AI as a tool to trim wordy explanations and get straight to the point.
  • Maintain an Even Tone: Avoid letting personal frustrations or over-enthusiasm color the technical content. Aim for a "neutral-expert" voice that remains consistent from start to finish.
  1. Eliminate Assumptions
  • Define Your Terms: Never assume a concept is "common knowledge."
  • External Context: Use hyperlinks to Wikipedia or official documentation for industry terms, protocols, or third-party tools to ensure readers of all levels can follow along.
@Integralist
Integralist / main.go
Last active May 6, 2026 05:31
Go: unexported interface methods "seal" the interface support when embedding types
// This code demonstrates how you can embed a type,
// and have it satisfy an interface (`ProblemDetailer`)
// but only for the embedded type.
// This works because the interface uses an unexported method,
// that is part of the embedded type's package.
// https://go.dev/play/p/7lbikIyPHi1
//
// IMPORTANT: If the `isProblem` inteface method was exported (i.e `IsProblem`),
// then our `Fake` struct would pass the `.(errorsx.ProblemDetailer)` type assertion
// e.g. https://go.dev/play/p/pPD3OgtiyHx