This file contains hidden or 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 | |
echo -e "\nHost:" | |
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -p 22 ubuntu@$1 \ | |
'uname -a && arch && uptime && sudo touch /home/ubuntu/.hushlogin /root/.hushlogin' | |
echo -e "\nAdding temporary SSH-key for Ubuntu root user..." | |
ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=ERROR -p 22 ubuntu@$1 \ | |
'sudo cat /home/ubuntu/.ssh/authorized_keys | sudo tee /root/.ssh/authorized_keys' | |
echo -e "\nSystem trimming..." |
This file contains hidden or 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 | |
RUNNING_STAGINGS=$(ls -ld /sys/fs/cgroup/memory/lxc.payload* | rev | cut -d'.' -f1 | rev | grep '\-staging\-') | |
### LXD API IMPLEMENTATION | |
get_stderr_code() { | |
id_container=$1 | |
id_operation=$2 | |
stderr_log=$(curl -s --unix-socket /var/snap/lxd/common/lxd/unix.socket lxd/1.0/instances/${id_container}/logs/exec_${id_operation}.stderr) | |
} |
This file contains hidden or 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 | |
declare -i last_called=0 | |
declare -i throttle_by=2 | |
@throttle() { | |
local -i now=$(date +%s) | |
if (($now - $last_called >= $throttle_by)) | |
then | |
"$@" |