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 / Interface Boxing.md
Created October 24, 2025 17:25
Go: Interface Boxing #perf

In Go, when you convert a concrete value (like a number or a struct) into an interface type, it's called interface boxing. This can sometimes cause performance problems because it can lead to hidden memory allocations on the heap, extra copying of data, and more work for the garbage collector. This is especially true for performance-critical code.

How it Works

An interface in Go is made up of two parts: a type descriptor and a data pointer. When you assign a value that isn't a pointer to an interface, Go might have to make a copy of that value on the heap. This can be slow and use a lot of memory, especially if you're working with large data structures.

The Problem

@Integralist
Integralist / Object Pooling.md
Last active October 24, 2025 17:22
Go: Object Pooling #perf

Object pooling helps reduce allocation churn in high-throughput Go programs by reusing objects instead of allocating fresh ones each time. This avoids repeated work for the allocator and eases pressure on the garbage collector, especially when dealing with short-lived or frequently reused structures.

Go's sync.Pool provides a built-in way to implement pooling with minimal code. It's particularly effective for objects that are expensive to allocate or that would otherwise contribute to frequent garbage collection cycles. While not a silver bullet, it's a low-friction tool that can lead to noticeable gains in latency and CPU efficiency under sustained load.

Object pooling allows programs to reuse memory by recycling previously allocated objects instead of creating new ones on every use. Rather than hitting the heap each time, objects are retrieved from a shared pool and returned once they're no longer needed.

@Integralist
Integralist / macOS Utilities.md
Last active October 21, 2025 14:51
macOS /usr/bin Utilities Summary

macOS /usr/bin Utilities Summary

This file lists each binary currently found in /usr/bin on this system (snapshot from ls /usr/bin) with a brief, high‑level description. Many are standard POSIX / BSD userland tools; others are Apple platform, developer, diagnostic, multimedia, DTrace scripts, Perl helper scripts, or language/runtime tools. Versioned duplicates (e.g. foo5.34) are Perl 5.34 module helper variants; they perform the same function for that specific interpreter version.

Note

Descriptions are concise and generalized. For authoritative detail consult man <tool> or --help.

Index

  • aa – ASCII art / legacy utility placeholder (rarely used)
@Integralist
Integralist / main.go
Last active October 17, 2025 13:34
Go: generate Private Key and CSR
// https://go.dev/play/p/nDnCcCkMlFj
package main
import (
"crypto/ecdsa"
"crypto/elliptic"
"crypto/rand"
"crypto/x509"
"encoding/pem"
"fmt"
@Integralist
Integralist / main.go
Created October 16, 2025 11:20
Go: fmt indexing
package main
import "fmt"
func main() {
fmt.Printf("%[1]s %[1]s %[2]s %[2]s %[3]s", "one", "two", "three") // yields "one one two two three"
}
@Integralist
Integralist / main.go
Created October 9, 2025 11:49
Go URL filter query parsing
package main
import (
"fmt"
"net/http"
"net/url"
)
func main() {
// Simulate a URL with filter parameters
@Integralist
Integralist / README.md
Last active October 2, 2025 11:11
Go API Optional Fields

Handling Optional and Nullable Fields

The API uses the optional package to distinguish between three states for a field in a JSON payload:

  1. Omitted: The field is not present in the JSON request body.
  2. Set to null: The field is present with an explicit null value (e.g., "description": null). This is used to unset or clear a field's value.
  3. Set to a value: The field is present with a non-null value (e.g., "description": "my description" or "description": "").
type Input struct {
	Description optional.String `json:"description"`
@Integralist
Integralist / SOCK5 Proxy.md
Created September 29, 2025 10:46
SOCK5 Proxy

Some people run a SOCKS5 proxy locally that proxies their internet traffic through a different location.

To access the proxy via your web browser you can either modify your system-wide proxy settings or use a Google Chrome browser extension, or in the case of Firefox manually configure the proxy settings.

Modify System-Wide Settings

  • Open System Preferences > Network.
@Integralist
Integralist / README.md
Created September 23, 2025 14:50
Let's Encrypt Pebble with mholt/acmez client
go get -tool github.com/letsencrypt/pebble/v2/cmd/pebble@latest
go tool pebble -version
go tool pebble -config pebble.json
go run main.go

Note

The cert and key here are public and aren't sensitive for the sake of local testing.

@Integralist
Integralist / README.md
Last active September 17, 2025 11:59
Check WHOIS server DNS status #shell

ZoneDB Scripts

This directory contains utility scripts for maintaining and validating the ZoneDB database.

Scripts

check_domain.sh

Purpose: Quick DNS resolution checker for individual domains.