Skip to content

Instantly share code, notes, and snippets.

View Cdaprod's full-sized avatar
🫠
Learn something new everyday!

David Cdaprod

🫠
Learn something new everyday!
View GitHub Profile
@Cdaprod
Cdaprod / ORIENTASSETS.md
Created February 4, 2026 16:05
How to ensure proper media assets orientation.

Premise

A ton of the videos I’ve shot from my camera and imported into my media-sync-api is rotated once clockwise 90° as landscape, causing me to have to adjust it 270° clockwise to have it be correctly oriented see example in screenshot.

The video container and photo metadata should be there for the asset(s) I need to automatically fix that for anything in my projects media. I want to not have a leftover copy when I’m done fixing them, and I don’t want the fixed file to have to be indexed again it should use the existing hashed index to overwrite it but with defensive programming so that we don’t have failures.

In fact defensive programming like this should cover other functionality we have.


@Cdaprod
Cdaprod / openai-shim-docker-server.sh
Last active November 5, 2025 16:11
Dockerized Codex Shim for completions to responses (standalone)
docker run -d \
--name codex-shim \
-p 3030:3030 \
-e LMSTUDIO_BASE="http://192.168.0.25:9999/v1" \
node:20-alpine \
sh -c "
apk add --no-cache nodejs npm &&
npm init -y >/dev/null &&
npm i express node-fetch@3 &&
cat <<'EOF' > server.js
@Cdaprod
Cdaprod / runner-setup.sh
Created August 21, 2025 15:23
GitHub Self Hosted Runner: Setup Script
#!/usr/bin/env bash
set -euo pipefail
# ─── Variables (override via environment) ─────────────────────────────────────
RUNNER_USER="${RUNNER_USER:-$USER}"
RUNNER_NAME="${RUNNER_NAME:-repo-runner-ephemeral}"
RUNNER_LABELS="${RUNNER_LABELS:-repo=default,arch=$(uname -m),role=ci,ephemeral}"
RUNNER_ID="${RUNNER_ID:-default}" # used in paths and service name
RUNNER_ROOT="${RUNNER_ROOT:-/opt/actions-runner/$RUNNER_ID}"
RUNNER_WORK="${RUNNER_WORK:-/home/$RUNNER_USER/actions-work/$RUNNER_ID}"
@Cdaprod
Cdaprod / f
Created August 20, 2025 14:26
#!/bin/bash
# Enhanced file finder script with fzf integration
# Save to /usr/local/bin/f and make executable with: chmod +x /usr/local/bin/f
# Process arguments
depth=""
num_regex='^[0-9]+$'
extensions=()
copy_to_clipboard=true
max_depth=""
#!/usr/bin/env bash
# Autostart tiler: Chromium (LEFT -> $URL) + terminal (RIGHT -> tmux attach to "recent" + optional follow-up)
# - If a tmux session exists, attach to the most-recent one by default.
# - Optionally inject a FOLLOWUP_CMD into that tmux session as a new window or split.
# - Falls back to plain shell if no tmux sessions exist.
# - Preserves your original tiling logic.
set -euo pipefail
# ---------------- config ----------------
@Cdaprod
Cdaprod / README.md
Last active July 24, 2025 19:09
Protect Your Code: This workflow ensures every file you create gets proper protection while being flexible enough for different business models (proprietary vs. dual licensing for your big projects).​​​​​​​​​​​​​​​​

Here’s a complete workflow to automatically apply your own protections to files via CI Workflow.

How to Use This Workflow

1. Initial Setup

# Save the script as protect-files.sh
chmod +x protect-files.sh
@Cdaprod
Cdaprod / dce-v1.sh
Last active July 24, 2025 17:58
Docker Exec Selector & Functioning Alias
##### dce example output #####
## Select a service:
## 1) video-api
## 2) video-web
## ?# 1
## Connecting to service: video-api
##############################
unalias dce
# V1: Docker Compose Exec with built-in service selectiondce() {
@Cdaprod
Cdaprod / obs-scripts_move_recording_to_unc.py
Created July 17, 2025 18:09
• Every time the Stream Deck (or any other trigger) stops a recording, the finished file is moved to your UNC share \\cda-desktop\b\Video\_INCOMING\sources\OBS-NDI-GARAGE. • If the share isn’t currently mapped, the script attempts a one-shot net use so it works even when OBS is running elevated. • All status / errors are written to the normal O…
"""
Move each finished recording to a UNC share.
OBSToolsScripts+select this file
---------------------------------------------------------
Works with Simple or Advanced output mode.
No change to your regular Recording Path is required;
in fact, keeping it on a local SSD makes the initial write faster.
---------------------------------------------------------
Tested with Python 3.11 + OBS 30.
@Cdaprod
Cdaprod / .md
Created July 4, 2025 16:59
Raspberry Pi 5 - VideoCoreVII GPU - Configuration Support

Updating Drivers for Ubuntu on Raspberry Pi 5 to support the VideoCore VII GPU

✅ GPU Support Overview

  1. Mesa / V3D (OpenGL ES & Vulkan) drivers included, thanks to upstream support merged since Mesa 23.3 .
  2. Initial desktop installs (e.g., Ubuntu 24.04/24.10) sometimes exhibit slow graphics, GNOME animation lag, even green-screen artifacts—likely due to incomplete or mismatched Mesa stacks .
  3. Community feedback highlights that while OpenGL ES/Vulkan are available, you may need to install or update Mesa packages manually (mesa-vulkan-drivers, etc.) .

To Update Drivers:

@Cdaprod
Cdaprod / docker-blender-all-in-one.sh
Created June 30, 2025 22:00
Blender-in-Docker “Factory-Startup” one-liner that procedurally creates a scene (plane textured with a phone-screen video, sun light, animated camera with Bézier easing), then headlessly renders the result to an H.264 MP4—no pre-existing .blend required. Ideal as a reproducible, copy-paste gist for anyone needing quick 3-D perspective moves on v…
docker run --rm -i -v "$PWD":/w linuxserver/blender:4.4.3 \
blender --factory-startup -b --python - <<'PY'
import bpy, math, os
vid = "/w/phone_screen.mp4" # <<< your vertical video
assert os.path.exists(vid), "Video missing"
# ------------------------------------------------------ build objects
bpy.ops.mesh.primitive_plane_add(size=2)
plane = bpy.context.object