Skip to content

Instantly share code, notes, and snippets.

@djasa
djasa / toggle_dark_mode.py
Created August 20, 2022 10:33
toggle dark mode in Gnome
#!/usr/bin/env python3
"""
switches Gnome between light and dark theme, after
a delay syncs Adwaita theme with system dark preference
Put into PATH and set a custom shortcut (mine is ctrl+shift+f2)
"""
from gi.repository import Gio
import time
@djasa
djasa / libvirt-update-resolved.py
Last active March 24, 2023 16:01
resolve VM in libvirt NAT'd domain by name with systemd-resolved as system DNS cache/resolver
#!/usr/bin/env python3
#
# copy this file to /etc/libvirt/hooks/network.d/ and make executable
#
import sys
import subprocess
import xml.etree.ElementTree as ET
# parse input
@djasa
djasa / update_httpd_configuration.yml
Last active September 10, 2021 20:48
Quick and dirty check of httpd configuration using 'apachectl configtest' in ansible
- name: "update httpd configuration"
tasks:
- name: "add a file"
block:
- copy:
dest: "{{ my_new_conf }}"
content: |
Options +MyCoolOption
notify: "restart httpd"