Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html lang="en">
<head>
<!-- hint: Put this in a folder, edit the IP address and port
variable MOON and just above there, the webcam URL
Then in the same folder run (if you want to use 8085 as the port #):
python3 -m http.server 8085
Then in Orca, set your device tab to http://127.0.0.1:8085/mini-dash.html
@wd5gnr
wd5gnr / more
Created October 28, 2025 00:06
Dumb more/less command if the system doesn't give you one and you don't want to install
#!/bin/ash
# Default lines per page
LINES_PER_PAGE=${PAGER_LINES:-20}
# Function to display a page
display_page() {
local start_line=$1
@wd5gnr
wd5gnr / klip-notify
Last active October 15, 2025 16:24
Telegram notifier for klipper
#!/bin/ash
/usr/bin/wget -qO- "http://127.0.0.1:7125/printer/gcode/script?script=GNR_DO_LAYER_NOTIFY%20LAYER=$1%20TOTAL=$2%20PCT=$3" &
exit 0
@wd5gnr
wd5gnr / macropad
Created July 29, 2025 21:37
Macropad configuration script
#!/bin/bash
LAYER=${1:-1}
LAYER1=wd5gnr-macro
LAYER2=wd5gnr-macro2
LAYER3=wd5gnr-macro3
SELECTED="LAYER$LAYER"
FN="/usr/local/share/macropad/${!SELECTED}.yaml"
if [ -f "$FN" ]
then
echo Loading $FN to macropad
@wd5gnr
wd5gnr / .proj_dirs
Created March 5, 2025 21:15
Project CD (example of making a dual-mode script that can alter the caller's environment)
PROJ_DIRS["docs"]="~/library/documents"
PROJ_DIRS["video"]="~/library/videos"
PROJ_DIRS["arduino"]="/home/alw/projects/embedded/Arduino"
@wd5gnr
wd5gnr / Notes.md
Created February 11, 2025 15:34
Simple Custom WPSD remote setup

You need to do the following:

  1. Copy pistar-remote.wd5gnr to /usr/local/sbin/pistar-remote.wd5gnr AND /usr/local/sbin/pistar-remote.wd5gnr.backup (important!)
  2. Copy the files (remote-user-hook-example0, bm_tg.py, gnrcheck) for /usr/local/bin to your /usr/local/bin directory
  3. Edit (don't copy) your /etc/pistar-remote to look like the one below
  4. Copy and Edit /home/pi-star/user-hook-data to fit your needs
  5. Make all the files except user-hook-data executable (e.g., chmod +x gnrcheck)

Commands

@wd5gnr
wd5gnr / main.py
Created January 16, 2025 03:14
ToF Sensor for MicroPython
from machine import UART, Pin
import utime
from binascii import hexlify
# Configuration settings
UART_ID = 0 # UART instance ID
BAUD_RATE = 115200 # Baud rate for UART communication
TX_PIN = 16 # UART TX pin
RX_PIN = 17 # UART RX pin
SAMPLE_RATE_HZ = 4 # Sampling rate in Hz
@wd5gnr
wd5gnr / aplay.py
Created September 24, 2024 18:43
Klipper Aplay Extra
# Play a sound from gcode
#
# Copyright (C) 2023 Al Williams
#
#
# This file may be distributed under the terms of the GNU GPLv3 license.
import os
import shlex
import subprocess
import logging
@wd5gnr
wd5gnr / hackcurl.c
Created January 30, 2024 02:34
Simple libcurl example (uses autogenerated skeleton)
/********* Sample code generated by the curl command line tool **********
* All curl_easy_setopt() options are documented at:
* https://curl.se/libcurl/c/curl_easy_setopt.html
************************************************************************/
// Pick up Hackaday home page
#include <curl/curl.h>
@wd5gnr
wd5gnr / trigwave.ino
Created December 13, 2023 20:52
Trigger Demo Waveforms
// For best results use Normal trigger mode
#define CLOCK 6 // ch1
#define DATA 15 // ch2
#define RS232_OUT 0 // D0 -- by default; this symbol is not used
#define RS232_IN 1 // not really used
#define ANALOG_CLEAR 21 // Discharge analog capacitor fast