Skip to content

Instantly share code, notes, and snippets.

View Vicfred's full-sized avatar
:octocat:
I like mathemagic and computering

Vicfred Vicfred

:octocat:
I like mathemagic and computering
View GitHub Profile
@Vicfred
Vicfred / firewall.md
Last active February 22, 2026 14:30
openbsd pf firewall and nftables config

OpenBSD PF config at /etc/pf.conf:

# -------------------------------------------------------------------------
# PF ruleset: 2 LANs (em1/em2) -> NAT out WAN (em0)
# - Default deny
# - Quiet WAN (drop inbound)
# - NAT for both LANs
# - Force clients to use router Unbound (block outbound 53/853 from LANs)
# - Isolate LAN A and LAN B
@Vicfred
Vicfred / openbsd_router.md
Last active February 28, 2026 20:41
OpenBSD Router

Below is a from-scratch OpenBSD router runbook you can keep as your “fresh install checklist”. It assumes your apu2c with 3 Intel i211AT NICs and your usual style: OpenBSD + rcctl, and you prefer dhcpd_flags="em1 em2" in rc.conf.local (no /etc/dhcpd.interfaces). I’ll also use your LAN search domain: cyberia.home.arpa.


0) Assumptions and goals

Topology (adjust names if yours differ):

  • em0 = WAN (behind CGNAT, upstream router gives it DHCP)
  • em1 = LAN1 172.16.0.0/24 (router IP 172.16.0.1)
@Vicfred
Vicfred / memetags.md
Created November 10, 2025 18:36
meme_tags

Meme Tag List (English / Spanish)

English tag Spanish tag / explicación corta
reaction reacción (respuesta genérica)
acknowledge visto / anotado
agreement de acuerdo / same
disagreement no / nah
deflection desviar tema / cambiar de tema
stalling dando largas / luego te digo
@Vicfred
Vicfred / docker.md
Created October 10, 2025 15:34
docker cheat sheet

Docker

docker system df # See what's eating space

docker ps
docker ps -a
docker container ls

docker stop <container> # SIGTERM, then SIGKILL after 10s (use -t N to change)
@Vicfred
Vicfred / ebuild.md
Created August 28, 2025 23:33
Filesize does not match recorded size gentoo emerge
ebuild --force /var/db/repos/dlang/dev-util/serve-d/serve-d-0.8.0_beta18.ebuild digest
@Vicfred
Vicfred / qemu_kvm_make_conf.md
Last active July 1, 2025 07:49
qemu kvm gentoo make.conf

no need separate /boot partition for BIOS on qemu EFI requires extra work to configure on qemu, BIOS is enough

/etc/portage/make.conf

#------------------------------------------------------------------------------
# CPU & optimization flags
#------------------------------------------------------------------------------
# march=znver4      → tune for AMD Zen 4 (Ryzen 7000 series)
# O2                → safe optimization level
@Vicfred
Vicfred / dlang_binary_search_lowerbound_upperbound.md
Created June 23, 2025 05:20
d language dlang binary search lower_bound upper_bound
size_t lowerBound(long[] arr, long value)
{
  size_t first = 0;
  size_t count = arr.length;
  while (count > 0)
  {
    size_t step = count / 2;
    size_t mid  = first + step;
    if (arr[mid] < value)
@Vicfred
Vicfred / gentoo_emoji_alacritty_zsh.md
Created June 4, 2025 02:53
emoji support in gentoo alacritty zsh

✅ Step 1: Install Emoji Font

emerge media-fonts/noto-emoji

This gives you Noto Color Emoji, which supports full-color emoji rendering.


@Vicfred
Vicfred / levenshtein.md
Created April 19, 2025 17:48
levenshtein

Levenshtein Edit Distance – Dynamic Programming Walk‑through

1. State definition

dp[i][j] = minimum edits needed to change
           the first i characters of A (A[0..i‑1])
           into the first j characters of B (B[0..j‑1])
@Vicfred
Vicfred / binary_search.md
Last active April 10, 2025 09:14
binary search and variations explanation intuition

Normal binary search

function binary_search(A, n, T) is
    L := 0
    R := n − 1
    while L ≤ R do
        m := floor((L + R) / 2)
        if A[m] < T then // everything on the left is less, move right, i.e., delete left
            L := m + 1
 else if A[m] &gt; T then // everything on the right is more, move left, i.e., delete right