Skip to content

Instantly share code, notes, and snippets.

View darkn3rd's full-sized avatar
🏠
Working from home

Joaquin Menchaca darkn3rd

🏠
Working from home
View GitHub Profile
@darkn3rd
darkn3rd / user_mode_net.md
Last active November 30, 2026 06:30
Libvirt Notes

libvirt: Port Forwarding vs. Direct Guest Access

Why Vagrant and Lima use localhost

They use user-mode networking: VirtualBox NAT for Vagrant, and QEMU slirp/user-v2 or vz for Lima. With that setup the guest has no address the host can reach, so ports have to be forwarded to 127.0.0.1. It also behaves the same on macOS and Windows, which is the main reason it's the default there.

@darkn3rd
darkn3rd / krunkit.md
Last active November 29, 2026 08:04
BLOG NOTES

Run Ubuntu on Apple Silicon with KrunKit

This is the KrunKit companion to my QEMU walkthrough. I’ll boot an Ubuntu cloud image, share the project directory with the guest, connect over SSH, and run the same Ansible provisioning step. KrunKit runs the VM, Podman supplies gvproxy for networking, and QEMU supplies qemu-img for disk conversion. QEMU walkthrough · KrunKit documentation

Run the snippets in order from the project directory in the same Bash session on an Apple Silicon Mac. This walkthrough uses the project’s existing cloud-init/user-data, cloud-init/meta-data, and playbook.yaml.

1. Install the tools

brew tap slp/krun
@darkn3rd
darkn3rd / Gentoo_virtualbox.md
Last active November 24, 2026 08:37
Challenges with GenToo

Gentoo and VirtualBox

Why No VirtualBox Support Now

Not in hako's Gentoo box today, but that's a project decision, not a limit of Gentoo or VirtualBox. The README says the image's kernel lacks the guest modules, and this was checked directly in the box (kernel 6.18.64-p1).

Verified in the box

  • CONFIG_VBOXGUEST is not set, and there are no vbox modules on disk. Guest Additions' vboxguest and vboxsf can't be loaded.
  • /lib/modules/.../build points to /usr/src/linux-6.18.64-p1, which doesn't exist. Both build-tree paths are dangling symlinks, so there is no kernel source or headers to compile modules against. gcc and make are installed, but that doesn't help without the tree.
@darkn3rd
darkn3rd / 01.haswell_notes.md
Last active November 23, 2026 19:43
Check for Haswell Chipset

Haswell (4th-gen Core, 2013) was the first Intel generation with AVX2, BMI1, BMI2, FMA3, MOVBE and LZCNT. F16C arrived earlier, with Ivy Bridge.

Model. The i5-1038NG7 is a 10th-gen Ice Lake chip, several generations past Haswell. It also supports AVX-512, which Haswell lacks.

Feature What it does Debuted with Haswell?
AVX2 Extends 256-bit SIMD to integer operations. The earlier AVX covered only floating point. It also adds gather loads and per-element variable shifts. Yes
FMA (FMA3) Fused multiply-add, computing a*b + c in one instruction with a single rounding. It's faster and more accurate for math, ML and graphics. Yes
BMI1 Bit-manipulation helpers such as ANDN, BLSR, BEXTR and TZCNT, for isolating, clearing and extracting bits. Yes
BMI2 More bit tools: PDEP/PEXT (bit scatter and gather), MULX, BZHI and flag-free shifts and rotates (SHLX, SHRX, RORX). Yes
@darkn3rd
darkn3rd / 01-overview.md
Last active November 28, 2026 17:44
Virtualization, Containers, MiroVMs, and WASM/WASI notes

Virtualization, Containers, MicroVMs, and WASM/WASI

Research notes on running software in isolated or foreign environments. Roughly ordered from most to least overhead: emulation → VMs → microVMs → containers → WASM.

Emulation and Binary Translation

  • QEMU TCG – CPU emulation of any ISA on any host
  • Rosetta 2 – x86_64 → ARM64 translation on macOS (also usable in Linux VMs)
@darkn3rd
darkn3rd / gpg_notes.md
Created October 15, 2026 16:59
gpg_notes.md

GPG with Git

# Create Key 
gpg --batch --generate-key <<EOF
Key-Type: RSA
Key-Length: 4096
Subkey-Type: RSA
Subkey-Length: 4096
@darkn3rd
darkn3rd / scaling_notes.md
Created August 6, 2026 20:37
scaling notes

I would first establish the workload characteristics and scaling target: current and expected traffic, read/write ratio, latency objective, data volume, availability requirements, regional requirements, and budget. Then I would scale each tier independently, because the application, cache, and database have different bottlenecks and consistency trade-offs.

1. Start with requirements

Before choosing an architecture, I would ask:

  • Is traffic steady, bursty, or seasonal?
  • Is the application stateless?
  • What are the read/write ratios?
  • What is the current bottleneck?
@darkn3rd
darkn3rd / cleanup_eks_network.sh
Last active June 12, 2026 02:17
Create EKS Cluster with Existing VPC
#!/usr/bin/env bash
set -euo pipefail
if [[ ! -f "./vpc-outputs.env" ]]; then
echo "ERROR: vpc-outputs.env not found in current directory." >&2
exit 1
fi
source ./vpc-outputs.env
@darkn3rd
darkn3rd / install_macos.sh
Last active January 7, 2026 23:46
Dev Tools Ubuntu 24 and Windows
#!/usr/bin/env bash
update_homebrew_path() {
# Google Style: Declare locals at the top.
# Capitalized because these will hold environment-like path strings.
local BREW_PREFIX
local GNU_PATHS
local KEG_PATHS
local RAW_COMBINED
local DEDUPE_LOGIC
@darkn3rd
darkn3rd / monitors.tf
Last active March 31, 2025 06:27
Datadog example for monitors
# Run Script to fetch monitors
# --------------------------------------
# WORKSPACE=$(terraform workspace show)
# [[ -d "./tfvars" ]] && VAR_DEFS_PATH="./tfvars"
# [[ -d ".././tfvars" ]] && VAR_DEFS_PATH=".././tfvars"
# [[ -z "$VAR_DEFS_PATH" ]] && { echo 'VAR_DEFS_PATH not specified. Aborting' >&2 ; exit 1; }
# DD_API_KEY="$(awk -F'"' '/dd_api_key/{ print $2 }' $VAR_DEFS_PATH/$WORKSPACE.secret.tfvars)"
# DD_APP_KEY="$(awk -F'"' '/dd_app_key/{ print $2 }' $VAR_DEFS_PATH/$WORKSPACE.secret.tfvars)"
# [[ -z "$DD_API_KEY" ]] && { echo 'DD_API_KEY not specified. Aborting' >&2 ; exit 1; }
# [[ -z "$DD_APP_KEY" ]] && { echo 'DD_APP_KEY not specified. Aborting' >&2 ; exit 1; }