Skip to content

Instantly share code, notes, and snippets.

View mittwillson's full-sized avatar
:shipit:
I may be slow to respond.

Mitt mittwillson

:shipit:
I may be slow to respond.
View GitHub Profile
/**
* Origin: https://update.greasyfork.org/scripts/5679/250853/Wait%20For%20Elements.js
* @param obj - {
* sel: 'a', // the selector you want to wait for (optional)
* context: document.body, // scope of search for selector or mutations (optional, default document.body)
* stop: true, // stop waiting after first result (optional, default false)
* mode: 'M', // M to use mutation observer, S to use setInterval (optional, default M)
* onchange: func, // if using mode 'M' this function will be called whenever mutation handler triggers
* onmatch: func, // if selector is specified function will be called for each match with element as parameter
* config: { attributes: true } // if using mode 'M' this object will override settings passed to mutation observer
#!/usr/bin bash
#
# Kill all zombies kvm process to release memory and idle cpu
#
# bash <(curl https://gist.github.com/MittWillson/6b8e6b8b68af4c18bc9eb138713284e9/raw/proxmox-kill-zombie-kvm)
# bash <(curl https://gist.github.com/MittWillson/6b8e6b8b68af4c18bc9eb138713284e9/raw/proxmox-kill-zombie-kvm) --kill
RUNNING=($(ps -ef | grep "kvm -id" | grep -v grep | awk '{print $2}'))
ALIVE_RUNNING=($(qm list|grep running|awk '{print $6}'))
#!/usr/bin/env bash
OLD_HOSTNAME=$(hostname)
NEW_HOSTNAME=$1
rename() {
echo $OLD_HOSTNAME > /.old_nodename
hostnamectl set-hostname "$NEW_HOSTNAME"
# edit hostname file