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
# Show value of $HOME when user does not preserve the environment | |
sudo bash -c 'echo $HOME' | |
# Show the value of $HOME when -E to preserve the sudo user's environment | |
sudo -E bash -c 'echo $HOME' | |
# Tip: If both are the same: | |
# | |
# - You ran this command directly as root (naughty!) |
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
declare -ag SUDO_CHCK=($(sudo sudo -V|awk '/(safety|sanity):[\r]?$/,/remove:[\r]?$/{if (/^E|^Lo/) next;gsub(/\t|\r/,"");print}'|sort -uV)) | |
declare -ag SUDO_REMV=($(sudo sudo -V|awk '/remove:[\r]?$/,/preserve:[\r]?$/{if (/^E|^Lo/) next;gsub(/\t|\r/,"");print}'|sort -uV)) | |
declare -ag SUDO_KEEP=($(sudo sudo -V|awk '/preserve:[\r]?$/,/^Loc/{if (/^E|^Lo/) next;gsub(/\t|\r/,"");print}'|sort -uV)) |
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
add-repo() { | |
add-repo_usage() { | |
# Help Blue, Help Blue Bold, Help Blue Italic, Italic Text and Reset Text | |
local HB='\e[38;2;72;226;225m' HBB='\e[1;38;2;72;226;225m' HBI='\e[3;38;2;72;226;225m' IT='\e[3m' RT='\e[0m' | |
printf "\n\e[2G${HBB}${FUNCNAME%_*}${RT}: ${IT}Add a repo using the new \x22signed-by\x22 feature${RT}\n\n" | |
printf "\e[2G${HBB}Usage${RT}:\n\n" | |
printf "\e[5G${FUNCNAME%_*} [ options ]\n\n" | |
printf "\e[2G${HBB}Options${RT}:\n\n" | |
printf "\e[5G-n,--repo-name\e[22GRepo Name\n\n" | |
printf "\e[5G-u,--repo-url\e[22GRepo URL (in sources.list format)\n\n" |
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 | |
cloud-init clean --logs | |
cloud-init init --local | |
cloud-init init | |
cloud-init modules --mode=config | |
cloud-init modules --mode=final |
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
amt-check() { | |
local G=https://github.com/mjg59/mei-amt-check.git | |
if [[ ! -f /srv/$(basename ${G%.*})/mei-amt-check ]];then | |
sudo chown -R $(id -un 1000):$(id -gn 1000) /srv | |
git clone ${G} /srv/$(basename ${G%.*}) | |
cd /srv/$(basename ${G%.*}) | |
make | |
fi | |
[[ -x /srv/$(basename ${G%.*})/mei-amt-check ]] && { sudo /srv/$(basename ${G%.*})/mei-amt-check; } | |
};export -f amt-check |
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 bash | |
# vim: set et ts=2 sw=2 filetype=bash : | |
[[ $_ != $0 ]] || { printf "\n\e[2G\e[1mPlease source this script!\e[0m ( e.g. \"source ${BASH_SOURCE[0]}\" )\n\n"; sleep 1;exit; } | |
maas-microcloud-lxd() { | |
[[ -n ${FDEBUG} && ${FDEBUG} = true ]] && { set -x &>/dev/null; } | |
local DESC="${FUNCNAME}: Deploy a LXD Cluster via MAAS command line" | |
local CI_TZ='America/Los_Angeles' | |
local CI_LC='en_US.UTF-8' | |
local CI_TC=${CI_LC:3:2} |
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
sudo wget -qO /usr/local/lxd-migrate --show-progress --progress=bar:force:noscroll $(curl -sSlL https://github.com/lxc/lxd/releases/latest|awk -F'"' '/href.*lxd-migrate/{print "https://github.com"$2}') | |
sudo chmod +x /usr/local/bin/lxd-migrate |
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
zfs-disable-snapshots() { | |
systemctl --user stop zsys-user-savestate.timer | |
systemctl --user disable zsys-user-savestate.timer | |
sudo mv /etc/apt/apt.conf.d/90_zsys_system_autosnapshot /etc/apt/apt.conf.d/90_zsys_system_autosnapshot.disabled | |
};export -f zfs-disable-snapshots | |
zfs-enable-snapshots() { | |
systemctl --user start zsys-user-savestate.timer | |
systemctl --user enable zsys-user-savestate.timer |
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 | |
declare -ag KASA_PKG_LIST=(); | |
for i in python3.10-venv build-essential python3 python3-pip python3-poetry python3-cachecontrol python3-argcomplete python3-all-dev python3-wheel python3-setuptools python-all-dev python-setuptools python3.10-venv python3-virtualenv;do | |
[[ $(dpkg -l $i|awk '/'${i}'/{print $1}') = ii ]] && { true; } || { PKG_LIST+=("${i}"); }; | |
done | |
[[ ${#KASA_PKG_LIST[@]} -ge 1 ]] && { sudo apt install ${KASA_PKG_LIST[@]} -yqf --auto-remove --purge -o Acquire::ForceIPv4=true; } || { true;printf "\n\nAll package dependencies already installed\x21\n\n"; } | |
python3 -m pip install --user --upgrade pip | |
python3 -m pip install --user virtualenv | |
python3 -m pip install --user python-kasa --pre |
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
/system script add dont-require-permissions=no name="Super=Mario-Bros" owner=admin policy=read source=":beep frequency=660 length=100ms;\n:delay 150ms;\n:beep frequency=660 length=100ms;\n:delay 300ms;\n:beep frequency=660 length=100ms;\n:delay 300ms;\n:beep frequency=510 length=100ms;\n:delay 100ms;\n:beep frequency=660 length=100ms;\n:delay 300ms;\n:beep frequency=770 length=100ms;\n:delay 550ms;\n:beep frequency=380 length=100ms;" | |
/system script add dont-require-permissions=no name="Thunderstruck" owner=admin policy=read source=":local n11 63,66;\n:local n12 64,67;\n:local n21 71,69,68,69,68,66,68,64,66,63;\n:local n22 64,63;\n \n:local n11 (\$n11,\$n11);\n:local n12 (\$n12,\$n12);\n:local n1 (\$n11,\$n11,\$n12,\$n12);\n:local n2 (\$n21,\$n22,\$n22,\$n22);\n:local notes (\$n1,\$n1,\$n2,\$n2);\n \n:local ticks 2;\n:local speed 55ms;\n:local stacc 5ms;\n# Transposition \n:local transpose -48;\n# ============================== \n# Don't change this: \n:local frqtab 8372,8869,9397,9956,10548,11175,11839,12543 |