dotfiles/bash/functions.sh

28 lines
1.1 KiB
Bash
Executable file

function tp {
if [ -d $1 ]
then
if ! gum confirm "$(basename $1) is directory! Do you really want to delete it?"
then
exit 1
fi
fi
mv $(realpath $1) $HOME/.local/share/Trash/files/
echo -e "[Trash Info]\nPath=$(realpath $1)\nDeletionDate=$(date "+%Y-%m-%dT%H:%M:%S")" > $HOME/.local/share/Trash/info/$(basename $1).trashinfo
gum style --bold --border rounded --border-foreground "#F5A9B8" --foreground "#5BCEFA" "$(basename $1) has been thrown in the bin"
}
function secure_erase {
dd if=/dev/urandom of=/dev/$1 bs=1M status=progress
dd if=/dev/urandom of=/dev/$1 bs=1M status=progress
dd if=/dev/urandom of=/dev/$1 bs=1M status=progress
dd if=/dev/urandom of=/dev/$1 bs=1M status=progress
curl --location --request POST 'https://gotify.cat-enby.club/message' --header 'X-Gotify-Key: $GOTIFY_KEY' --header 'Content-Type: application/json' --data-raw '{
"appid": 1,
"message": "Disk /dev/$1 successfully erased",
"title": "secure_erase complete",
"date": "$(date +"%Y-%m-%d %T")",
"priority": 5
}'
echo "Disc /dev/$1 erased successfully"
}