Skip to content

Instantly share code, notes, and snippets.

View HitLuca's full-sized avatar
👨‍💻
Doing AI stuff

Luca Simonetto HitLuca

👨‍💻
Doing AI stuff
View GitHub Profile
@HitLuca
HitLuca / main.py
Created March 29, 2022 10:03
DearPyGUI 1.4.0, dragging images on the canvas
import dearpygui.dearpygui as dpg
# thing user last clicked
global currentPick
currentPick = None
# thing mouse last hovered
global currentSelection
currentSelection = None
@HitLuca
HitLuca / ufw_allow_cloudflare_ips_443.sh
Last active July 28, 2022 13:54
Outputs a series of ufw rules that enable external access from legitimate Cloudflare ips to port 443
#!/bin/sh
cd /tmp
wget https://www.cloudflare.com/ips-v4 -O ips-v4-$$.tmp
wget https://www.cloudflare.com/ips-v6 -O ips-v6-$$.tmp
for cfip in `cat ips-v4-$$.tmp`; do echo "sudo ufw allow from $cfip to any port 443 proto tcp comment 'Cloudflare ipv4'"; done
for cfip in `cat ips-v6-$$.tmp`; do echo "sudo ufw allow from $cfip to any port 443 proto tcp comment 'Cloudflare ipv6'"; done
@HitLuca
HitLuca / spoolman-integration.md
Created June 12, 2026 12:46
Integrating Spoolman with Klipper-toolchanger-easy

I'm creating this gist mostly to help out other people in configuring and setting up spoolman to both:

  • allow setting a spool for each tool
  • handle spool switching and state management

My examples use two tools since that's what I have right now

first off (assuming you have a working spoolman integration running already, as well as [save_variables] set up) you'll need to set spool support for each tool

[gcode_macro T0]
variable_active: 0
@HitLuca
HitLuca / toolchanger_led_effects.md
Created June 12, 2026 12:54
klipper led-effects integration with toolchanger setups

This gist will help you in setting up klipper led-effects for a toolchanger setup. The code used here works with any number of tools. Make sure to write all the macros for each tool to avoid issues with jinja macro parsing (if T0_set_logo_leds doesn't exist but it's called, the macro will end up calling the T0 macro instead)

Main led effect macros

These macros are the main entrypoint, and will call tool-specific effects as necessary

[gcode_macro set_logo_leds_off]
gcode:
    {% if params.TOOL is defined %}
        SET_LED_EFFECT EFFECT=T{params.TOOL}_set_logo_leds STOP=1