Skip to content

Instantly share code, notes, and snippets.

@pgdad
pgdad / fetch_file.py
Created July 30, 2025 08:19
Python utilities for fetching files from DNS TXT records
#!/usr/bin/env python3
"""
fetch_file.py - Fetch a single file from DNS TXT records
Usage: python3 fetch_file.py <filename> [output_directory] [index_hostname]
Environment: PORKBUN_INDEX (default: index)
"""
import argparse
import json
@pgdad
pgdad / fetch-file.ps1
Created July 24, 2025 21:10
PowerShell scripts for porkbun-txt DNS file storage system (Windows compatible)
#!/usr/bin/env pwsh
# fetch-file.ps1 - Fetch a single file from DNS TXT records
# Usage: .\fetch-file.ps1 <filename> [output_directory]
param(
[Parameter(Mandatory=$true)]
[string]$Filename,
[Parameter(Mandatory=$false)]
@pgdad
pgdad / fetch-file.sh
Created July 24, 2025 14:38
Bash scripts for porkbun-txt DNS file storage system
#!/bin/bash
# fetch-file.sh - Fetch a single file from DNS TXT records
# Usage: ./fetch-file.sh <filename> [output_directory]
set -e
# Check if filename is provided
if [ "$#" -lt 1 ] || [ "$#" -gt 2 ]; then
echo "Usage: $0 <filename> [output_directory]" >&2
@pgdad
pgdad / multi-files-concatenate-kafka
Created May 2, 2025 11:33
example kafka with listener spring boot multiple brokers
// Project structure:
// - pom.xml
// - src/main/java/com/example/dualkafka/
// - DualKafkaApplication.java (Main application class)
// - config/
// - FirstKafkaConfig.java (First Kafka broker config)
// - SecondKafkaConfig.java (Second Kafka broker config)
// - listener/
// - FirstKafkaListener.java (Listener for first broker)
// - SecondKafkaListener.java (Listener for second broker)
@pgdad
pgdad / emacs-config-cfn
Created September 10, 2021 19:23
emacs edit indirect use for cfn lambda
(defvar-local lainedev-edit-indirect-leading-spaces 0)
(defun lainedev--leading-spaces ()
(interactive)
(let* ((current-line (thing-at-point 'line 't))
(line-length (length current-line))
(trimmed-line (replace-regexp-in-string "^ +" "" current-line))
(trimmed-line-length (length trimmed-line)))
(- line-length trimmed-line-length)))