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 / 1. README.md
Last active May 29, 2025 14:00
Basic Go Project Structure #go #project
.
├── Makefile
├── cmd
│   └── api
│       └── main.go
├── go.mod
├── go.sum
├── internal
│   ├── api
@Integralist
Integralist / main.go
Last active May 29, 2025 14:00
Go: Serialize and Deserialize types using gob #go #serialization
// 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 May 29, 2025 14:01
Go: Ring Buffers #go #ring #circular #queue

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 May 29, 2025 14:01
Go: Generate UML #go #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
Last active May 29, 2025 14:02
Go: Exponential Backoff #go #backoff #retry #resilience
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.

@Integralist
Integralist / Math - How to identify a number.md
Created February 27, 2025 10:32
Math: How to identify a number

Here is how a number is divided up...

So how do we identify large numbers?

The "trick" is to always group the digits in threes from right to left, starting with the smallest unit (ones).

Here's how it works:

@Integralist
Integralist / dns.sh
Last active May 26, 2025 15:49
DNS: Lookup of Host information #dns #lookup #host
$ dig www.integralist.co.uk +noall +answer
; <<>> DiG 9.10.6 <<>> www.integralist.co.uk +noall +answer
;; global options: +cmd
www.integralist.co.uk. 14400 IN CNAME dreamy-wing-b0b998.netlify.com.
dreamy-wing-b0b998.netlify.com. 120 IN A 3.75.10.80
dreamy-wing-b0b998.netlify.com. 120 IN A 3.125.36.175
$ curl -so /dev/null -D - https://dreamy-wing-b0b998.netlify.com