Skip to content

Instantly share code, notes, and snippets.

@jpsutton
jpsutton / systemd-shutdown-diag.py
Created January 27, 2025 14:43
Python application to analyze the most recent systemd shutdown events to see what was services were taking time to shutdown.
import sys
import subprocess
from datetime import datetime
from tabulate import tabulate
# Dictionary to store the 'Stopping' event timestamps
stopping_events = {}
# Dictionary to store the elapsed time for each service
@jpsutton
jpsutton / README.md
Last active January 28, 2025 19:00
Run AI models on Docker Compose in a more secure way (no egress)

Notes

  1. This is jank.
  2. Modify setup_model.sh to change the AI model in use. If you change the model, you may need to delete the "ollama_data" folder.
  3. This setup assumes that you're using an Nvidia GPU and have the Nvidia Container Toolkit setup on the host OS.
  4. Steps to running this:
    • Download files from the gist to a folder.
    • Open a terminal to that folder, and run docker-compose up
  5. After everything is running, the web UI should be available on http://localhost:3000
@jpsutton
jpsutton / toggle_mic_mutes.py
Last active July 10, 2025 15:34
Toggle all microphones mute status with on-screen indicator
#!/usr/bin/env python3
import pulsectl
import dbus
import time
def show_notification(title, message, icon_name):
"""
Show a KDE desktop notification using D-Bus directly.