Skip to content

Instantly share code, notes, and snippets.

View cdracars's full-sized avatar
🎯
Focusing

Cody Dracars cdracars

🎯
Focusing
  • CFS Brands, LLC
  • Oklahoma City Oklahoma
  • X @cdracars
View GitHub Profile
@cdracars
cdracars / README.md
Last active November 24, 2025 04:00
Klipper Print Progress Overlay for OBS - Display printer status, progress, and temps

Klipper Print Progress for OBS

Display your 3D printer's progress, temperatures, and status in OBS using Klipper/Moonraker/Mainsail.

Setup Instructions

1. Configure Moonraker CORS Settings

You need to allow cross-origin requests so OBS can fetch data from your printer.

# ============================================================================
# KLIPPER HEAT SOAK MACRO (SMART: TIME OR CHAMBER TEMP)
# ============================================================================
# Author: Cody Dracars
# Date: 2025-04-05 (smart mode added 2025-09-25)
# License: MIT
#
# Heats bed to target and performs a soak using either:
# - Time-based countdown, or
# - Chamber-temperature target with hold requirement (if a chamber sensor exists)
Here's an actually correct way to set your Z offset:
Home the toolhead so the inductive probe will be just above the
plate. (You want the next step to heat it up so your measurements
will include its thermal expansion.),
Heat the bed to the middle of the bed temperature range for the
filament you want to print with. 60C is a good start for PLA if
your filament manufacturer doesn't specify.,
# ============================================================================
# KLIPPER HEAT SOAK MACRO
# ============================================================================
#
# A comprehensive heat soak macro for Klipper 3D printers that heats the bed
# to a target temperature and maintains it for a specified duration to warm
# the printer chamber/enclosure for materials like ABS, ASA, PC, etc.
#
# Features:
# - Configurable bed temperature and soak duration
@cdracars
cdracars / setup_findread.sh
Last active September 20, 2024 16:55
Find Read setup script
#!/bin/bash
# Detect user's default shell from the SHELL environment variable
default_shell=$(basename "$SHELL")
# Path to the correct shell config file based on user's default shell
shell_config=""
if [[ "$default_shell" == "zsh" ]]; then
shell_config="$HOME/.zshrc"
elif [[ "$default_shell" == "bash" ]]; then
#!/usr/bin/env bash
# Adapted from https://medium.com/@sean.handley/how-to-set-up-docker-for-mac-with-native-nfs-145151458adc
set -o errexit
set -o pipefail
set -o nounset
OS=$(uname -s)
@cdracars
cdracars / gist:f14a1498f4b1280b8b6fba709a28e0aa
Created January 9, 2023 15:18
Generate a JWT token with public/private key python
@router.get("/jwt/token")
async def generate_jwt() -> dict[str, bytes] | Literal[False]:
"""Returns JWT Token dev work.
Returns:
Token string or False.
"""
private_key = load_pem_private_key(
@cdracars
cdracars / pre-commit
Created July 14, 2022 21:21
Pre-Commit Generate .env.example file that is sanitized.
#!/bin/sh
# Generate example env file from current env file.
sed 's/=.*/=/' .env > .env.example
git add .env.example
@cdracars
cdracars / .git-commit-template.txt
Created February 11, 2022 15:44 — forked from adeekshith/.git-commit-template.txt
This commit message template helps you write great commit messages and enforce it across teams.
# <type>: (If applied, this commit will...) <subject> (Max 50 char)
# |<---- Using a Maximum Of 50 Characters ---->|
# Explain why this change is being made
# |<---- Try To Limit Each Line to a Maximum Of 72 Characters ---->|
# Provide links or keys to any relevant tickets, articles or other resources
# Example: Github issue #23
@cdracars
cdracars / form_state_update.py
Created November 9, 2021 22:30
Very basic python script to update form_state from Drupal 7 to Drupal 9.
#!/usr/bin/env python3
import re
filename = 'fsp_competitive_cross_reference.cut_n_paste.inc'
# Read in the file
with open(filename, 'r') as file:
filedata = file.read()