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 / MySQL Virtual Column.md
Last active April 28, 2026 13:33
MySQL Virtual Column (Generated Column)

In MySQL, a Virtual Column (specifically known as a Generated Column) is a column whose value is automatically calculated from an expression or other columns in the same table, rather than being explicitly inserted or updated by a user.

Think of it like a formula in an Excel spreadsheet: you define the rule once, and the database ensures the data stays in sync.


The Two Types of Generated Columns

MySQL offers two "flavors" of these columns, and the distinction is mostly about storage space versus CPU performance:

@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
@Integralist
Integralist / MySQL EXPLAIN — The Ultimate Performance Guide.md
Last active March 26, 2026 15:01
MySQL EXPLAIN: The Ultimate Performance Guide

🚀 MySQL EXPLAIN: The Ultimate Performance Guide

Database optimization can feel like a dark art, but the EXPLAIN command is your "Matrix vision." It reveals how MySQL plans to execute your query before you run it.


1. The Starting Line: Slow Query Log

You can't fix what you can't find. Use the Slow Query Log to catch queries that exceed a specific time threshold.

@Integralist
Integralist / Prometheus Metrics.md
Last active March 13, 2026 14:20
Prometheus Metrics

Prometheus Metric Types: A Quick Reference

This guide explains the four core Prometheus metric types, including common "patterns" that might seem counter-intuitive at first glance.

1. Counter

Definition: A cumulative metric that represents a single monotonically increasing counter. Its value can only increase or be reset to zero on restart.

  • Best for: "How many times has X happened?"
  • Examples: Total HTTP requests, total errors, bytes received.
@Integralist
Integralist / HTML ASCII Encoding Reference.md
Created February 19, 2026 15:09
HTML ASCII Encoding Reference
@Integralist
Integralist / redirect.go
Created February 19, 2026 10:39
Go: trie redirects with wildcard support
// First complete match wins.
// Because exact children are tried before `*` which is tried before `**`.
// The most-specific rule wins without an explicit priority sort.
package redirect
import (
"fmt"
"strings"
)
@Integralist
Integralist / README.md
Created February 16, 2026 14:48
Go: ignore vendor directory for multi-language repo

In a multi-language repository—for example, one that includes both Go and Ruby—you can run into conflicts around the vendor/ directory. Ruby commonly uses a vendor/ directory to store dependencies, but Go’s toolchain assumes that a vendor/ directory follows its own vendoring format (including the modules.txt file that defines vendored modules).

If Ruby’s vendor/ directory is present, the Go toolchain may attempt to interpret it as a Go vendoring directory, leading to unexpected errors.

To prevent this, configure Go to use module mode explicitly and ignore the vendor/ directory (which, in this case, is only relevant to Ruby):

  • Add -mod=mod to commands such as go build and go test.
  • Set a global flag with export GOFLAGS=-mod=mod for commands like go tool that do not expose a -mod flag directly.
@Integralist
Integralist / Hyphen vs En Dash vs Em Dash.md
Last active February 3, 2026 12:42
Hyphen vs En Dash vs Em Dash

Hyphen (-)

Connects words, parts of words, or numbers.

En Dash (–)

To indicate ranges or relationships.

Option (⌥) + -

@Integralist
Integralist / convert aifc to m4a.sh
Created January 21, 2026 15:32
Convert aifc to m4a #audio
for f in *.aifc; do
ffmpeg -i "$f" -c:a aac -b:a 192k "${f%.aifc}.m4a"
done