Skip to content

Instantly share code, notes, and snippets.

View ssokolow's full-sized avatar

Stephan Sokolow ssokolow

View GitHub Profile
@ssokolow
ssokolow / update_flatpak_cli.py
Last active January 21, 2026 00:24
Utility for making Flatpak-installed apps available in the terminal through their normal command names
#!/usr/bin/env python3
"""Flatpak CLI Shortcut Generator
A simple no-argument tool that generates launchers with traditional non-flatpak
command names for your installed Flatpak applications in ~/.local/bin/flatpak.
Does full collision detection and warns you if you forgot to add its output
directory to your PATH. Also overrules the command-line specified in the
``.desktop`` file if the Flatpak maintainer didn't include support for
command-line arguments.
@ssokolow
ssokolow / Disable Root Cert Updates.reg
Created December 26, 2025 01:26
Registry patch to apply if your method for keeping Windows 7 off the Internet induces 25-second delays when starting some games
Windows Registry Editor Version 5.00
; Use this if you're blocking off network access in a way which causes timeouts
; and it's causing some games to wait 25 seconds on every game start as DirectX tries
; to check the root certs for updates as part of video driver signature checking
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates\AuthRoot\AutoUpdate]
"DisableWebRetrieval"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\SystemCertificates\AuthRoot]
"DisableRootAutoUpdate"=dword:00000001
@ssokolow
ssokolow / anon.sh
Last active December 2, 2025 18:52
Zsh command to make an "incognito mode" for a terminal
# Convenience helper to set up an "incognito mode" for a shell session.
#
# Installation:
# 1. Create a folder like ~/.zsh/functions
# 2. Add it to your ZSH function path with fpath=(~/.zsh/functions(:A) $fpath) in ~/.zshenv
# 3. Save this script as ~/.zsh/functions/anonsh
# 4. Add `autoload -Uz anonsh` to your ~/.zshrc
#
# Now you can type `anonsh` in any zsh session
#
@ssokolow
ssokolow / .Xresources
Created December 1, 2012 20:52
.Xresources settings to make Motif look a bit less archaic for DDD
! ---=== Experiment with making Motif less ugly for DDD ===---
! (DDD ignores generically-set Motif properties so we must do this)
! TODO (if possible):
! - Hide text cursors in unfocused fields
! - Convert on-hover effect from shadow to background color or border
! - Pick better fonts and check which package provides them
! Use the lighter background grey from the Lubuntu GTK+ theme
! (Still a cool grey. Eyedropper the Clearlooks warm grey if necessary.)
Ddd*background: #e0e0e0
@ssokolow
ssokolow / update_check.py
Last active November 24, 2025 14:01
Simple apt-get update notifier using desktop notifications and cron
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Simple notify2-based apt-get update notifier
Requires:
- dbus-python (A.K.A. python-dbus)
- notify2
- python-gobject (for Python 2.x)
(Though it shouldn't be too difficult to adapt to Python 3.x since
@ssokolow
ssokolow / x11_watch_active_window.py
Last active October 30, 2025 02:18
python-xlib example which reacts to changing the active window
#!/usr/bin/env python
"""python-xlib example which reacts to changing the active window/title.
Requires:
- Python
- python-xlib
Tested with Python 2.x because my Kubuntu 14.04 doesn't come with python-xlib
for Python 3.x.
@ssokolow
ssokolow / dialog_collapsed_with_reporting_callback.png
Last active August 3, 2025 01:56
Port and refactoring of gtkexcepthook.py for PyQt 5.x and Python 3.5+
dialog_collapsed_with_reporting_callback.png
@ssokolow
ssokolow / win7.sh
Created February 12, 2025 05:05
Script to trigger a KVM switch on Linux by blinking Scroll Lock
#!/bin/bash
# Toggle the KVM switch programmatically by toggling the Scroll Lock LED
# Source: https://askubuntu.com/a/546989/23552
SLEEP=0.5
LEDNAME="Scroll Lock"
echo "Switching..."
xset led named "$LEDNAME"
sleep $SLEEP
@ssokolow
ssokolow / term_qt.py
Created April 26, 2020 09:04
Example of creating a simple terminal emulator widget from a QTextEdit
"""Primitive terminal emulator example made from a PyQt QTextEdit widget."""
import fcntl, locale, os, pty, struct, sys, termios
import subprocess # nosec
# Quick hack to limit the scope of the PyLint warning disabler
try:
# pylint: disable=no-name-in-module
from PyQt5.QtCore import Qt, QSocketNotifier # type: ignore
from PyQt5.QtGui import QFont, QPalette, QTextCursor # type: ignore
@ssokolow
ssokolow / thunderbird_esc_fix.py
Created June 22, 2025 16:30
Helper to keep the Thunderbird Quick Filter Bar from seeing Escape keypresses
#!/usr/bin/env python3
"""Helper to block Esc key presses from reaching Thunderbird
(Works by using XGrabKey to claim Esc on all Thunderbird "3pane" windows,
either at startup or when the window first receives focus.)
Requires:
- Python
- python-xlib