Skip to content

Instantly share code, notes, and snippets.

View scriptogre's full-sized avatar

Christian Tanul scriptogre

View GitHub Profile
@scriptogre
scriptogre / nixos-homelab.md
Last active April 1, 2026 04:38
NixOS Homelab on a ThinkCentre M90Q (Docker, Caddy, Plex, AdGuard, Tailscale)

NixOS Homelab on a ThinkCentre M90Q

This is how I set up my homelab, step by step, in roughly the order I actually did it. Each step builds on the previous one. Read until you hit where you're at and stop.

Step 1: A minimal NixOS flake that just works

The first thing to get right is flake.nix. This is your entire system config: users, networking, firewall, packages, services. Everything in one file.

Here's a minimal starting point. Set a static IP so your other devices can always find the server. Enable Docker and SSH. Disable sleep. That's it.

@scriptogre
scriptogre / htmx-4-architecture-proposal.md
Last active January 21, 2026 08:43
Proposal for htmx 4.0 unified config architecture - everything is config, micro-kernel design

htmx 4.0 Architecture Proposal

The Problem

Currently:

hx-swap      →  own parser, storage, handling logic
hx-target    →  own parser, storage, handling logic
hx-headers → own parser, storage, handling logic
@scriptogre
scriptogre / LIVE-ALTERNATIVE.md
Last active January 11, 2026 22:17
Client-side reactivity for htmx: two syntax proposals for reactive bindings and enhanced events.

htmx-live (Alternative Syntax)

Client-side reactivity via a single hx-live attribute. Hyperscript-inspired syntax with DOM literals.

Same functionality as LIVE.md, different syntax.


In Action

@scriptogre
scriptogre / job_table.html
Last active November 19, 2025 05:13
Real-time background job status updates with htmx, SSE and PostgreSQL LISTEN/NOTIFY. Database fields change → LISTEN/NOTIFY → SSE → row re-fetches it's own data. Each row listens for its own job-specific SSE event.
{% from "jobs/job_block.html" import render_job_rows %}
<table id="job-table" class="..."
sse-connect="/jobs/events"
{# Fixes race-condition when the job finishes before connection to /job/events is made #}
hx-get="/jobs/table"
hx-trigger="load once delay:500ms"
hx-swap="morph"
hx-disinherit="*"
>
@scriptogre
scriptogre / gist:1389dcc4f35b610b9bbd2f1ffa1bdef4
Last active November 11, 2025 20:55
htmx 4.0 WebSocket Extension Design

WebSockets Extension Design

Overview

The WebSockets extension provides bidirectional real-time communication for htmx, following the same patterns established by the built-in SSE (Server-Sent Events) streaming support.

Core Principles

  1. Consistency with SSE - Incoming messages use the same swapping behavior (hx-target, hx-swap, <hx-partial>)
  2. Leverage existing attributes - Reuse hx-vals, hx-include, hx-trigger, hx-config
@scriptogre
scriptogre / pure-css-tabs.html
Last active April 15, 2025 22:46
Pure CSS responsive tabs with mobile and desktop support using Jinja2 for dynamic rendering.
{#
Pure CSS responsive tabs using a templating engine (e.g., Jinja2); supports mobile (select) and desktop (radio) views, with tab visibility controlled via :has() selectors and loop-based dynamic CSS generation.
#}
<style>
/* Hide panels by default */
.tab-panels > .tab-panel { display: none; }
{% for _ in tabs %}
@media (max-width: 639px) {
@scriptogre
scriptogre / jinja2.py
Last active March 18, 2025 12:34
Ports Django 5.1's `{% querystring %}` template tag functionality to Jinja2.
# config/jinja2.py
"""
Ports Django 5.1's `{% querystring %}` template tag (https://docs.djangoproject.com/en/5.1/releases/5.1/#querystring-template-tag)
to a Jinja2 global function for `django-jinja`.
Add this to `config/jinja2.py`, then in your settings file:
TEMPLATES = [
{
'BACKEND': 'django_jinja.jinja2.Jinja2',
@scriptogre
scriptogre / django_widget_tweaks.py
Created September 6, 2023 10:06
This provides a migration of the functionalities of `django-widget-tweaks` to be compatible with Jinja2 and Django-Jinja.
"""
django_widget_tweaks.py
This module provides a migration of the functionalities of `django-widget-tweaks` to be compatible with Jinja2 and Django-Jinja.
The need for this migration arose because `render_field` was not easily migratable to Jinja2 otherwise.
To use this in your project, save this code into a Python file and then add it to your INSTALLED_APPS in settings.py:
INSTALLED_APPS += ["path.to.your.module.django_widget_tweaks"]
Example usage in a Jinja2 template:
@scriptogre
scriptogre / git_commit_reminder.sh
Last active August 17, 2023 10:38
A script tailored for Linux developers working in PyCharm. Its purpose is to encourage and aid developers, especially those accustomed to chaotically writing code, to adopt the atomic commit approach. The script continuously monitors the number of uncommitted changes in a Git repository. Once changes surpass a defined threshold, a notification p…
#!/bin/bash
# ---------------------------------------------------------------------------
# Commit Reminder Script for Linux
# Author: Christian Tanul
# GitHub Gist: https://gist.github.com/scriptogre/1d97f599da72efa5e39731eaf5e4da96/
#
# Description:
# This script aids developers in transitioning to the atomic commit approach,
# especially those who tend to write code chaotically. It's designed to be used