Skip to content

Instantly share code, notes, and snippets.

View dezren39's full-sized avatar
🕵️‍♂️
Processing..

Drewry Pope dezren39

🕵️‍♂️
Processing..
View GitHub Profile
@croxton
croxton / htmx-metadata.js
Created October 13, 2022 13:46
Htmx swapping metadata
htmx.on('htmx:beforeSwap', (htmxEvent) => {
let incomingDOM = new DOMParser().parseFromString(htmxEvent.detail.xhr.response, "text/html");
// Transpose <meta> data, page-specific <link> tags and JSON-LD structured data
// Note that hx-boost automatically swaps the <title> tag
let selector = "head > meta:not([data-revision]), head *[rel=\"canonical\"], head *[rel=\"alternate\"], body script[type=\"application/ld+json\"]";
document.querySelectorAll(selector).forEach((e) => {
e.parentNode.removeChild(e);
});
incomingDOM.querySelectorAll(selector).forEach((e) => {
if (e.tagName === 'SCRIPT') {
@dezren39
dezren39 / consul-firewalld.md
Created August 11, 2022 21:57 — forked from mbillow/consul-firewalld.md
Consul FirewallD Service Definition

Consul FirewallD Service Definition

A simple service definition for Consul agents; meant to simplify the installation process of Consul.

This is based on the information provided by Hashicorp in the Consul Docs.

Installation

  1. Download the XML file:
  • Either wget {raw_url} consul.xml
@mutantmell
mutantmell / network.nix
Last active October 16, 2024 01:43
NixOS Router data-driven configuration
{ config, pkgs, lib, ... }:
let
# There were two main sources of inspiration for this configuration:
# 1. https://pavluk.org/blog/2022/01/26/nixos_router.html
# 2. https://francis.begyn.be/blog/nixos-home-router
# Thank you very much!
#
# network types:
# { type = "none"; } # Don't generate a network file
$Path = $env:TEMP
$Installer = "chrome_installer.exe"
Invoke-WebRequest "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile $Path$Installer
Start-Process -FilePath $Path$Installer -Args "/silent /install" -Verb RunAs -Wait
Remove-Item $Path$Installer
@matthewpi
matthewpi / README.md
Last active March 31, 2025 21:07
Nix on Fedora

NixOS on Fedora

Please note that these instructions are not offically supported or condoned by Nix and are not guaranteed to always work, but from my testing everything seems to work perfectly fine.

These steps may not be required if NixOS/nix#2374 is resolved.

SELinux

These commands are required for both Fedora Workstation and Fedora Silverblue

@eliasdaler
eliasdaler / 0_bench_test.go
Last active February 17, 2024 08:35
The quest for a good vector library for a gamedev
package main
import (
"testing"
"github.com/go-gl/mathgl/mgl32"
"github.com/kvartborg/vector"
"github.com/ungerik/go3d/vec2"
"gonum.org/v1/gonum/mat"
)
@udf
udf / write_up.md
Last active April 15, 2025 07:57
A Trick To Use mkMerge at The Top Level of a NixOS module

The Setup

I wanted to write a module that generates multiple systemd services and timers to scrub some zfs pools at certain intervals. The default scrub config does not support individual scrub intervals for each pool.

I want the config to look like this:

{
  services.zfs-auto-scrub = {
 tank = "Sat *-*-* 00:00:00";

Hi @nrdxp + @edolstra -- I have a couple ideas for how to make things marginally better here but, tl;dr: I'd like feedback or direction from either or both of you on my idea before I invest more time, especially for exploring the proposed solutions that require C++ development. (Also, please let me know if you'd like me to move this from an issue comment to an RFC or even a, e.g., Google Doc design doc, for easier interaction.)

Problem Statement

In my words at a minimum:

flake authors need to be able to request submodule-fetching for the repository hosting flake.nix

(Please see my appendix for supporting use cases and UX/DX considerations if you aren't already convinced about this need. Also, @nrdxp, please let me know if you actually have a different motivating problem in mind?)

@terrabitz
terrabitz / bubbletea_multiple_listeners.go
Created February 5, 2021 19:37
Multiple tea.Msg Listeners
package main
import (
"context"
"fmt"
"log"
"net/http"
"net/http/httputil"
"strings"
"time"