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 / ctxkey.md
Last active March 28, 2025 09:21
Why choose tailscale.com/util/ctxkey over Go standard context package #go #golang #ctx
@Integralist
Integralist / DNS Delegation.md
Last active March 26, 2025 18:05
DNS Delegation #dns

DNS Management and Delegation

If a domain owner wants to use another company for handling DNS management over its domain, then they can update the "Name Servers" for their domain wherever DNS is currently managed, and set the Name Servers to a different DNS provider.

This is known as DNS delegation.

Once that Name Server change has propagated, the new DNS provider will be responsible for managing DNS records for the domain.

CNAME redirection magic

@Integralist
Integralist / 1. README.md
Last active March 17, 2025 15:16
Basic Go Project Structure #go #golang #base #project
.
├── Makefile
├── cmd
│   └── api
│       └── main.go
├── go.mod
├── go.sum
├── internal
│   ├── api
@Integralist
Integralist / main.go
Created March 14, 2025 17:22
Serialize and Deserialize Go types using gob #go #golang
// Package gob manages streams of gobs - binary values exchanged between an Encoder
// (transmitter) and a Decoder (receiver).
package main
import (
"bytes"
"encoding/gob"
"fmt"
"log"
)
@Integralist
Integralist / Improving dig output.md
Last active March 12, 2025 16:32
Improving dig output #dns #dig #bash #shell

Outcome

Screenshot 2025-03-12 at 16 31 37

Implementation

# digg adds colors to the standard dig output to improve readability while not losing contextual information.
#
DIG_COMMENT_COLOR_SINGLE="\e[38;5;8m"  # Dark grey text, no background, no bold
@Integralist
Integralist / Well-Known URIs.md
Last active March 11, 2025 17:57
Well-Known URIs #IANA #Well-Known

.well-known is a standardized path on a website's root domain that allows services to access metadata and configurations related to that domain. It's defined by RFC 5785.

The IANA (Internet Assigned Numbers Authority) maintains a registry of well-known URIs, ensuring that these paths are standardized and avoid conflicts.

@Integralist
Integralist / Ring Buffers in Go.md
Last active March 11, 2025 16:18
Ring Buffers in Go #go #golang #ring #circular #buffers #queues

What's a ring buffer?

Ring buffers are known by a few names, such as circular queues and circular buffers.

A ring buffer is a fixed-size, circular data structure that overwrites the oldest data when the buffer is full. It’s particularly useful for scenarios where you want to store and retrieve data in a FIFO (First-In-First-Out) manner but with limited memory. When the buffer reaches its size limit, new data will overwrite the oldest data.

Instead of adding on the end and popping from the end, like a stack, you can add to one end and remove from the start, like a queue. And as you add or remove things, the start and end pointers move around. By managing these pointers, a ring buffer naturally enforces the FIFO order.

What's the benefit?

@Integralist
Integralist / Generate UML from Go Project Code.bash
Last active March 11, 2025 11:18
Generate UML from Go Project Code #go #golang #uml #design #architecture #diagram
# install dependencies
brew install graphviz plantuml librsvg
# generate puml file for entire project
go run github.com/jfeliu007/goplantuml/cmd/goplantuml@latest -recursive ./ > Example.puml
# generate SVG from entire project
plantuml Example.puml -o "$pwd" -tsvg
# convert SVG into a PDF
@Integralist
Integralist / main.go
Created March 10, 2025 10:19
Exponential Backoff in Golang #go #golang #backoff #retry
package main
import (
"context"
"errors"
"fmt"
"math"
"time"
)
@Integralist
Integralist / Project Planning.md
Last active March 17, 2025 14:45
Project Planning #project #architecture #design #planning

There are three types of documents you should write, in this specific order:

  1. Project document
  2. Discovery document
  3. Design document

A "project" document is for planning the overarching/broader project work.
It's responsible for breaking down the project into smaller milestones.

A "discovery" document is for discovering how we'll solve ONE of the milestones defined in the project document.