This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# | |
# prep_scummvm_games.py | |
# Copyright 2025 Stephan Sokolow | |
# | |
# Helper for batch-adding ScummVM games to ES-DE. | |
# | |
# License: MIT (https://opensource.org/license/mit) | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import shlex | |
def lex_shellscript(script_path, statement_cb): | |
"""Given a file-like object, use a POSIX-mode shlex.shlex object to split | |
it into statements and call the given statement processor to convert | |
statements into dicts. | |
""" | |
fields = {} | |
with open(script_path, 'r') as fobj: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "unimportant_if_subsumed_by_setuptools" | |
version = "0.1.0" | |
authors = ["Your Name Here <your@email.com>"] | |
[lib] | |
name = "unimportant_if_subsumed_by_setuptools" | |
crate-type = ["cdylib"] | |
[dependencies.cpython] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Reasonably efficient pagination without OFFSET | |
-- SQLite version (Adapted from MS SQL syntax) | |
-- Source: http://www.phpbuilder.com/board/showpost.php?p=10376515&postcount=6 | |
SELECT foo, bar, baz, quux FROM table | |
WHERE oid NOT IN ( SELECT oid FROM table | |
ORDER BY title ASC LIMIT 50 ) | |
ORDER BY title ASC LIMIT 10 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
"""A demonstration of implementing (most of) org.kde.StatusNotifierItem using | |
QtDBus to serve as as an example of how more advanced QtDBus features map to | |
PyQt5, absent robust documentation for how the schema annotations translate. | |
""" | |
import os | |
import signal | |
import sys |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
"""Example code for a PyQt image-display widget which Just Works™ | |
TODO: Split this into a loader wrapper and a widget wrapper so it can be used | |
in designs which maintain a preloaded queue of upcoming images to improve | |
the perception of quick load times. | |
""" | |
from __future__ import (absolute_import, division, print_function, |
NewerOlder