This file contains 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
from functools import wraps | |
import inspect | |
# This defines a decorator that can be used on an instance method, to stop it from being inherited by child classes | |
class _private_method(object): | |
def __init__(self, decorated): | |
self._decorated = decorated | |
def __set_name__(self, owner, name): | |
@wraps(self._decorated) |
This file contains 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 | |
import os | |
import sys | |
import platform | |
import tempfile | |
from zipfile import ZipFile | |
if platform.system() == "Windows": | |
import win32api, win32con, win32process |
This file contains 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 sh | |
# | |
# Explain a given shell command using explanation from explainshell.com | |
# | |
# Usage: explainshell <command> | |
# | |
# Credit: Derived from https://github.com/benjamine/explain.sh | |
# License: MIT | |
URL="$*" |
This file contains 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 | |
# Flags to enable/disable various functionality (set flag to zero to disable) | |
UPDATE_MIRRORLIST=1 | |
UPDATE_KEYRING=1 | |
USE_POWERPILL=1 | |
REPORT_CACHE_STATS=1 | |
# Config elements | |
MIRRORLIST="/etc/pacman.d/mirrorlist" |
This file contains 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 | |
# This is a quick-and-dirty script to monitor the execution of a process, wait for it to die, | |
# and then ensure that the Ubisoft client dies shortly thereafter. This is useful, as when | |
# running under Lutris, Ubisoft games spawn the Ubisoft client, and it remains running after | |
# the game itself has quit. On my system, the Ubisoft client remaining running will keep | |
# the screen awake, which is decidedly undesirable. | |
# Enable the following 3 lines for debugging, if needed | |
#set -x |
This file contains 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 | |
GUEST_NAME=Win10_With_GPU | |
job_exited="false" | |
exec_result=$(virsh -c qemu:///system qemu-agent-command "$GUEST_NAME" '{"execute": "guest-exec", "arguments": { "path": "nvidia-smi.exe", "arg": [ "--format=csv,noheader", "--query-gpu=temperature.gpu" ], "capture-output": true }}') | |
exec_pid=$(echo "$exec_result" | jq ".return.pid") | |
while [ "$job_exited" == "false" ]; do | |
exec_job_data=$(virsh -c qemu:///system qemu-agent-command "$GUEST_NAME" '{"execute": "guest-exec-status", "arguments": { "pid": '" ${exec_pid}}}") |
This file contains 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 | |
SERVICE="org.kde.KWin" | |
DBUS_PATH="/org/kde/KWin/InputDevice" | |
INTERFACE="org.kde.KWin.InputDevice" | |
METHOD_GET="org.freedesktop.DBus.Properties.Get" | |
METHOD_SET="org.freedesktop.DBus.Properties.Set" | |
function find_touchpad { | |
DM_INTERFACE="org.kde.KWin.InputDeviceManager" |
This file contains 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 | |
import sys | |
import json | |
import time | |
import subprocess | |
import statistics | |
""" | |
{ "sensor_low": 35, "sensor_high": 40, "fan_level": 30 }, |
This file contains 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 | |
import dbus | |
import dbus.mainloop.glib | |
import gi | |
from gi.repository import GLib | |
# Initialize the D-Bus main loop | |
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) |