From aeb86466d793e0ebfda316d8ed7fa04309a12a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Mei=C3=9Fner?= <florian.meissner@mailbox.org> Date: Tue, 27 Dec 2022 16:51:03 +0100 Subject: [PATCH] stuff --- bone_xfce.sh | 6 ++++++ memory_usage.sh | 8 ++++++++ modprobe_old_kernel.sh | 20 ++++++++++++++++++++ mount_8tb.sh | 4 ++++ onedrive.sh | 26 ++++++++++++++++++++++++++ pa_virtual.sh | 2 +- restic_docs.sh | 21 --------------------- run_docker_in_vm.vagrantfile | 1 + virtual_audio.sh | 9 +++++++++ vpn_uni.sh | 5 +++-- 10 files changed, 78 insertions(+), 24 deletions(-) create mode 100644 bone_xfce.sh create mode 100755 memory_usage.sh create mode 100755 modprobe_old_kernel.sh create mode 100755 mount_8tb.sh create mode 100755 onedrive.sh delete mode 100755 restic_docs.sh create mode 100644 run_docker_in_vm.vagrantfile create mode 100755 virtual_audio.sh diff --git a/bone_xfce.sh b/bone_xfce.sh new file mode 100644 index 0000000..4d8c0b3 --- /dev/null +++ b/bone_xfce.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +xfconf-query -c keyboard-layout -p "/Default/XkbDisable" -s "false" +xfconf-query -c keyboard-layout -p "/Default/XkbLayout" -s "de" +xfconf-query -c keyboard-layout -p "/Default/XkbVariant" -s "bone" + diff --git a/memory_usage.sh b/memory_usage.sh new file mode 100755 index 0000000..de5aac7 --- /dev/null +++ b/memory_usage.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +argparse --exclusive c,p --max-args 1 'c/command' 'p/pid' -- $argv + +set -q _flag_command ; and set psargs -eC $argv[2] +ps -eo pid,size,command | grep $1 +ps -eo size,command | grep $1 | awk '{ hr=$1/1024 ; sum += hr} END {print sum " MiB"}' + diff --git a/modprobe_old_kernel.sh b/modprobe_old_kernel.sh new file mode 100755 index 0000000..d929862 --- /dev/null +++ b/modprobe_old_kernel.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env fish + +# fancy select kernel version +set kernel_pkg (ls -1 /var/cache/pacman/pkg/linux* | grep -E '(.*)linux[[:digit:]]+-[[:digit:]]+(.*)' | fzf) +# even fancier select kernel version +#set kernel_pkg (ls -1 | grep "linux-"(string replace "-MANJARO" "" (uname -r)) + +#echo $kernel_pkg +#echo $argv[1] + +set tempdir (mktemp -d || exit) +cd $tempdir + +function on_exit_rm_tempdir --on-event fish_exit + prevd + rm -rf $tempdir +end + +tar xf $kernel_pkg || exit +sudo modprobe -d usr $argv[1] diff --git a/mount_8tb.sh b/mount_8tb.sh new file mode 100755 index 0000000..cdd50e2 --- /dev/null +++ b/mount_8tb.sh @@ -0,0 +1,4 @@ +id +sudo cryptsetup luksOpen --key-file /root/8tb_keyfile /dev/disk/by-uuid/b94a609d-d734-4cae-bc6a-2f4dcff47afd luks-b94a609d-d734-4cae-bc6a-2f4dcff47afd || exit 1 +sudo vgchange -ay BackupGroup || exit 2 +udisksctl mount --block-device /dev/disk/by-uuid/5b4b9e59-eaef-4189-bb4c-42d81f9b94ee || exit 3 diff --git a/onedrive.sh b/onedrive.sh new file mode 100755 index 0000000..8bea746 --- /dev/null +++ b/onedrive.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env fish + + +if [ $argv[1] = '--help' ] + echo "\ +Dieses Skript wird vor den Aufruf eines Kommandos gestellt und setzt die nötigen +rclone-Variablen. Wenn restic als Kommando erkannt wird, werden auch hier +Parameter für das backup/restic repository vorangestellt injiziert.\ + " + exit +end + +set -x RCLONE_CONFIG_PASS (cat $HOME/Documents/__wichtig__/passwords/rclone_config) + +# Debugging rclone +#set -x RCLONE_VERBOSE 2 + +set restic_args -r=rclone:onedrive_ohm:/backup/restic \ + --password-command="cat $HOME/Documents/__wichtig__/passwords/restic_onedrive_ohm" + +if [ $argv[1] = 'restic' ] + restic $restic_args $argv[2..] +else + exec $argv +end + diff --git a/pa_virtual.sh b/pa_virtual.sh index 5a511a8..b774f5c 100755 --- a/pa_virtual.sh +++ b/pa_virtual.sh @@ -2,5 +2,5 @@ pacmd load-module module-null-sink sink_name=MySink pacmd update-sink-proplist MySink device.description=MySink pacmd update-source-proplist "MySink.monitor" device.description="\"MySink Monitor\"" -pacmd load-module module-loopback sink=MySink source=alsa_input.usb-Kingston_HyperX_Cloud_II_Wireless_000000000001-00.mono-fallback +#pacmd load-module module-loopback sink=MySink source=alsa_input.usb-Kingston_HyperX_Cloud_II_Wireless_000000000001-00.mono-fallback pacmd load-module module-loopback source=MySink.monitor sink=alsa_output.usb-Kingston_HyperX_Cloud_II_Wireless_000000000001-00.analog-stereo diff --git a/restic_docs.sh b/restic_docs.sh deleted file mode 100755 index ba59f72..0000000 --- a/restic_docs.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -export RCLONE_CONFIG_PASS=$(cat $HOME/Documents/__wichtig__/passwords/rclone_config) - - - -myrestic=(-r=rclone:onedrive_ohm:/backup/docs \ - --password-command="cat $HOME/Documents/__wichtig__/passwords/restic_onedrive_ohm") - -#echo $myrestic -#restic "${myrestic[@]}" unlock -# Read a string with spaces using for loop -for backup_path in "$HOME/Documents" "$HOME/scripts" "$HOME/Sync/pymass.kdbx" "/crypto_keyfile.bin" -do -# RCLONE_CONFIG_PASS=$(cat $HOME/Documents/__wichtig__/passwords/rclone_config) restic \ -# -r rclone:onedrive_ohm:/backup/docs \ -# --password-command "cat $HOME/Documents/__wichtig__/passwords/restic_onedrive_ohm" \ -# backup --exclude .cache --exclude-caches $backup_path - - restic "${myrestic[@]}" backup --exclude .cache --exclude-caches $backup_path -done diff --git a/run_docker_in_vm.vagrantfile b/run_docker_in_vm.vagrantfile new file mode 100644 index 0000000..1d7fe86 --- /dev/null +++ b/run_docker_in_vm.vagrantfile @@ -0,0 +1 @@ +#!/usr/bin/env vagrant diff --git a/virtual_audio.sh b/virtual_audio.sh new file mode 100755 index 0000000..39b4961 --- /dev/null +++ b/virtual_audio.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +pacmd load-module module-null-sink sink_name=MySink +pacmd update-sink-proplist MySink device.description=MySink +pacmd update-source-proplist "MySink.monitor" device.description="\"MySink Monitor\"" + +pacmd load-module module-loopback source=MySink.monitor sink=alsa_output.usb-Kingston_HyperX_Cloud_II_Wireless_000000000001-00.analog-stereo + +# pacmd load-module module-loopback sink=MySink source=alsa_input.usb-Kingston_HyperX_Cloud_II_Wireless_000000000001-00.mono-fallback diff --git a/vpn_uni.sh b/vpn_uni.sh index b3fc2af..52380c7 100755 --- a/vpn_uni.sh +++ b/vpn_uni.sh @@ -5,15 +5,16 @@ VPN_PASSWORD_FILE=$(dirname $0)/pws/vpn_uni #VPN_PASSWORD_FILE=/home/ra1n/scripts/pws/vpn_uni VPN_SERVER=vpn.ohmportal.de +_uid=1000 echo $(dirname $0) args=( # set protocol to globalprotect - probably don't change this --protocol=gp # drop privs after connect - --setuid=$UID + --setuid=$_uid # drop privs during vpn script - --csd-user=$UID + --csd-user=$_uid # vpn user name -u $VPN_USER -- GitLab