Skip to content

Instantly share code, notes, and snippets.

@ConnerWill
ConnerWill / How-To.md
Created April 3, 2026 19:25 — forked from martin-niklasson/How-To.md
How to make an up-to-date OpenWRT image for loading onto a Raspberry Pi Compute Module 4 with a DFRobot Router Carrier Board.

The background is that the default OpenWRT image for Raspberry Pi lacks drivers for the LAN port (RTL8111) on the DFRobot board. DFRobot provide an image, but that one is made from a quite old daily snapshot of OpenWRT which is not entirely stable. Also, it is better to know how to fish than be given a fish.

DFRobot's page about the router board:
https://wiki.dfrobot.com/Compute_Module_4_IoT_Router_Board_Mini_SKU_DFR0767

OpenWRT main page:
https://openwrt.org/

You are expected to have some general knowledge on Linux and OpenWRT. The instructions for flashing the resulting firmware image are presented on DFRobot's page.

@ConnerWill
ConnerWill / bash_progress_bar.sh
Created January 27, 2026 14:58
Bash progress bar script
#!/bin/env bash
### FUNCTION ###{{{
function bash_progress_bar(){
## Localize Variables ##{{{
local \
@ConnerWill
ConnerWill / bash-script-template.sh
Created December 19, 2025 20:42
Yet another bash script template
set -Eeuo pipefail
# ---------- UI helpers ----------
RED=$'\e[31m'; GRN=$'\e[32m'; BLU=$'\e[34m'; YLW=$'\e[33m'; BLD=$'\e[1m'; CLR=$'\e[0m'
err() { printf "%s[ERROR]%s %s\n" "$RED" "$CLR" "$*" >&3; }
ok() { printf "%s[OK]%s %s\n" "$GRN" "$CLR" "$*" >&3; }
info() { printf "%s[INFO]%s %s\n" "$BLU" "$CLR" "$*" >&3; }
warn() { printf "%s[WARN]%s %s\n" "$YLW" "$CLR" "$*" >&3; }
require_root() { [[ $EUID -eq 0 ]] || { err "Please run as root (sudo)."; exit 1; }; }
@ConnerWill
ConnerWill / wrap_pattern_stl.py
Last active April 29, 2025 16:35
Engraves an SVG pattern onto the surface of an STL model using Blender’s Python API with shrinkwrap, solidify, and boolean modifiers.
"""
Usage:
blender --background --python wrap_pattern.py -- \
--stl flask.stl \
--svg pattern.svg \
--output flask_wrapped.stl
Notes:
- The -- is required before the Python script arguments.
- All paths are relative to this script's directory or absolute.
@ConnerWill
ConnerWill / dynuddnsupdate.sh
Created April 15, 2025 19:24
Script to update DDNS IP for DynuDNS domain
#!/usr/bin/env bash
#### OPTIONS
set -o errexit -o pipefail
#### DEFINITIONS
PROG=$(basename "${0}")
DDNS_USERNAME="${DDNS_USERNAME:-}"
@ConnerWill
ConnerWill / dynuddns.sh
Created April 15, 2025 19:24
Simple script to update DDNS IP for DynuDNS domain
#!/usr/bin/env bash
# https://www.dynu.com/DynamicDNS/IPUpdateClient/cURL
#### OPTIONS
set -o errexit -o pipefail
#### DEFINITIONS
@ConnerWill
ConnerWill / home-external-ip.sh
Created March 7, 2025 18:47
Script to update a file on a remote server with the external IP address of your local computer. This is handy for semi-automated DDNS
#!/usr/bin/env bash
### VARIABLES
VERBOSE=1
DEBUG=0
REMOTE_USER="your_remote_user" # Set your remote server username
REMOTE_HOST="your.remote.server.com" # Set your remote server's IP or domain
REMOTE_FILE_PATH="/home/${REMOTE_USER}/home-external-ip" # Set the path to the file on the remote server
SSH_KEY_PATH="${HOME}/.ssh/id_rsa" # Path to your SSH private key
EXTERNAL_IP_SERVICE="https://ifconfig.me" # External IP address service
@ConnerWill
ConnerWill / Configuration.h
Created February 18, 2025 17:36
Marlin configs for Ender 3 Pro Sprite BTTMiniSKRE3v2.0
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@ConnerWill
ConnerWill / PID-tune-bed.gcode
Last active February 18, 2025 15:49
GCODE for ender3 pro config
; [---------------------------------------------------------------------------]
; | PID Bed Tune |
; |---------------------------------------------------------------------------|
; | Printer: Ender 3 Pro |
; | Board: BTT SKR Mini E3 v2.0 |
; | Extruder: Creality Sprite Direct Drive |
; | |
; [---------------------------------------------------------------------------]
; Auto-tune bed at 60 °C for 8 cycles: https://marlinfw.org/docs/gcode/M303.html
@ConnerWill
ConnerWill / ssh_failed_attempts_graph.py
Created October 9, 2024 20:10
Python script to graph the number of failed SSH login attempts
#!/usr/bin/env python3
import re
from collections import defaultdict
# Path to the auth.log file
LOG_FILE = '/var/log/auth.log'
# Function to parse the log file and count failed login attempts per IP address
def parse_ssh_failed_attempts_by_ip(log_file):