2020-08-02 17:01:23 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
function do-startx() {
|
2020-08-23 12:10:29 +02:00
|
|
|
startx "$@" >| ~/.xsession-log 2>&1 &
|
2020-08-02 17:01:23 +02:00
|
|
|
sleep 1
|
|
|
|
vlock
|
|
|
|
}
|
|
|
|
|
|
|
|
function encode-with-ffmpeg() {
|
|
|
|
movie=$1
|
|
|
|
output=$2
|
|
|
|
|
2020-08-23 12:10:29 +02:00
|
|
|
ffmpeg -y -i "$movie" -c:v libx264 -preset veryslow -b:v 630k -pass 1 -c:a aac -b:a 128k -f mp4 /dev/null && \
|
|
|
|
ffmpeg -i "$movie" -c:v libx264 -preset veryslow -b:v 630k -pass 2 -c:a aac -b:a 128k "$output"
|
|
|
|
}
|
|
|
|
|
2020-09-06 15:51:42 +02:00
|
|
|
function run-apt-upgrade() {
|
2022-07-10 19:18:42 +02:00
|
|
|
local upgrade_seq='mail; echo "Starting update" && sudo systemd-inhibit --what=shutdown:idle:sleep /bin/bash -c "apt clean && apt update && apt upgrade && apt autoremove && tripwire --check --interactive"'
|
2020-09-06 15:51:42 +02:00
|
|
|
local host=$1
|
2020-08-23 12:09:49 +02:00
|
|
|
|
2020-09-06 15:51:42 +02:00
|
|
|
if [[ -z $host ]]; then
|
|
|
|
echo "No host name provided, exiting."
|
|
|
|
exit 1;
|
|
|
|
elif [[ $host = $(hostname) || $host = $(hostname --fqdn) ]]; then
|
|
|
|
echo "Running upgrade command locally."
|
2020-12-27 12:28:49 +01:00
|
|
|
eval "tmux new-session -d -A -s apt-updates \; send-keys '${upgrade_seq}' ENTER\; attach"
|
2020-09-06 15:51:42 +02:00
|
|
|
else
|
|
|
|
echo "Running upgrade command remotely."
|
|
|
|
ssh "$host" -t "tmux new-session -d -A -s apt-updates \; send-keys '${upgrade_seq}' ENTER \; attach"
|
|
|
|
fi
|
2020-08-02 17:01:23 +02:00
|
|
|
}
|
2020-08-23 12:23:37 +02:00
|
|
|
|
|
|
|
function tmux-main() {
|
|
|
|
tmux attach -t main || \
|
|
|
|
tmux new-session -d -A -s main \; \
|
|
|
|
send-keys 'journalctl --follow' ENTER \; \
|
|
|
|
split-window \; \
|
2022-06-04 11:12:59 +02:00
|
|
|
send-keys 'htop' ENTER \; \
|
2022-01-05 17:55:48 +01:00
|
|
|
split-window \; \
|
2021-06-12 12:50:23 +02:00
|
|
|
select-layout even-vertical \; \
|
2020-08-23 12:23:37 +02:00
|
|
|
attach-session -t main
|
|
|
|
}
|
2021-11-07 07:15:17 +01:00
|
|
|
|
|
|
|
# https://unix.stackexchange.com/questions/22834/how-to-uncompress-zlib-data-in-unix
|
|
|
|
function zlibd() {
|
|
|
|
printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - "$@" | gzip -dc
|
|
|
|
}
|