Skip to content

Instantly share code, notes, and snippets.

View vwbusguy's full-sized avatar

Scott Williams vwbusguy

View GitHub Profile
@vwbusguy
vwbusguy / forgejo-update.sh
Created November 29, 2023 20:13
forgejo-update
#!/bin/bash
DLOAD_DIR=/opt
gitea_help () {
echo -e "Usage: gitea-upgrade <version>\n\nSee https://codeberg.org/forgejo/forgejo/releases for current versions.\n";
echo $1;
}
case $(uname -m) in
@vwbusguy
vwbusguy / Containerfile
Created March 30, 2022 22:39
Enable cowsay in Ansible AWX EE
FROM ansible/awx-ee:latest
USER root
RUN dnf config-manager --set-enabled epel && \
dnf install epel-release epel-next-release -y && \
dnf install --refresh cowsay -y
USER 1000
@vwbusguy
vwbusguy / auto-profile-update.sh
Last active March 8, 2024 21:27
Auto Update for power-profiles-daemon
#!/bin/bash
dbus-monitor --system "type='signal',path='/org/freedesktop/UPower/devices/battery_BAT0',member='PropertiesChanged'" | while read LINE; do
echo ${LINE} | grep battery_BAT0 | grep -q PropertiesChanged
if [ $? -eq 0 ]; then
BATT_STAT=$(dbus-send --print-reply=literal --system --dest=org.freedesktop.UPower /org/freedesktop/UPower/devices/battery_BAT0 org.freedesktop.DBus.Properties.Get string:org.freedesktop.UPower.Device string:State | awk '{ print $3; }')
if [ $BATT_STAT -eq 1 ] || [ $BATT_STAT -eq 4 ]; then
LEVEL=$(powerprofilesctl list | grep -q performance && echo "performance" || echo "balanced")
elif [ $BATT_STAT -eq 5 ]; then
LEVEL="balanced"
@vwbusguy
vwbusguy / check_containers.py
Created February 11, 2020 18:09
Gnome Notification for running podman containers with button to kill them
#!env/bin/python
import gi, subprocess, sys, time
gi.require_version('Notify', '0.7')
from gi.repository import GLib,Notify
class App():
def __init__(self):
self.containers = []
@vwbusguy
vwbusguy / gist:34622a340362b0ee9cabdce00ddd75bd
Created February 11, 2020 01:01
Gnome notification for running podman containers
#!env/bin/python
import gi, subprocess, sys
gi.require_version('Notify', '0.7')
from gi.repository import Notify
containers = []
keys=['created','name','image']
pman_out = subprocess.run(["podman","ps","--format",'{{.Created}}|{{.Names}}|{{.Image}}'],capture_output=True)
if pman_out.returncode == 0:
@vwbusguy
vwbusguy / dnf-fix-dupes
Created June 8, 2019 04:50
Remove duplicates after a botched dnf upgrade
# Use at your own risk! You should try `dnf remove --duplicates` first. Use this as a last resort.
sudo rpm -e --nodeps $(sudo dnf check 2>/dev/null | grep duplicate | cut -f1 -d' ')
@vwbusguy
vwbusguy / gist:548eea3d2cebe3f1d556658e4574ff38
Created April 9, 2018 14:37
Example Regex for parsing OpenLdap logs (Ruby flavor - works for FluentD)
/^(?<time>\w{3}\s+\d \d{1,2}:\d{1,2}:\d{1,2}) (?<host>[\w\-\d]+) (?<process>\w+)\[(?<pid>\d+)\]\: ((conn=(?<conn>\d+) (fd=(?<fd>\d+))?(op=(?<op>\d+))?)?\s?(?<message>.*))$/