config/shell: script adjustments
This commit is contained in:
parent
2437dce296
commit
109db5cebb
|
@ -45,8 +45,8 @@ yas() {
|
||||||
)
|
)
|
||||||
if test -n "$pkg"
|
if test -n "$pkg"
|
||||||
then echo "Installing $pkg..."
|
then echo "Installing $pkg..."
|
||||||
cmd="yay -Sy --batchinstall --rebuildall $pkg"
|
cmd="yay -S --batchinstall --rebuildall $pkg"
|
||||||
print -s "$cmd"
|
print -s $cmd
|
||||||
eval "$cmd"
|
eval "$cmd"
|
||||||
rehash
|
rehash
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -272,9 +272,10 @@ curlh() {
|
||||||
|
|
||||||
unalias u 2>/dev/null # for bash
|
unalias u 2>/dev/null # for bash
|
||||||
u() {
|
u() {
|
||||||
# Line below handy for users of netkeeper
|
# Line below handy for users of netkeeper internet blocker
|
||||||
#sudo nft list ruleset | grep -q outall && echo "Suspending netkeeper" >&2 | echo 'pausing netkeeper for sysupgrade' | netkeeper 30 2>/dev/null
|
#sudo nft list ruleset | grep -q outall && echo "Suspending netkeeper" >&2 | echo 'pausing netkeeper for sysupgrade' | netkeeper 30 2>/dev/null
|
||||||
if command -v pacman >/dev/null; then
|
if command -v pacman >/dev/null; then
|
||||||
|
sudo find /var/lib/pacman/db.lck -mmin +600 -delete 2>/dev/null && echo 'Deleted stale pacman db.lock'
|
||||||
if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)"
|
if test "$(stat /etc/pacman.d/mirrorlist --printf=%y | cut -d'-' -f1-2)" != "$(date +%Y-%m)"
|
||||||
then
|
then
|
||||||
# TODO also run if location changed significantly or mirror is slow
|
# TODO also run if location changed significantly or mirror is slow
|
||||||
|
|
|
@ -50,6 +50,7 @@ fileinfo() {
|
||||||
# I think this check is here to avoid scrolling text interpreted as video
|
# I think this check is here to avoid scrolling text interpreted as video
|
||||||
#probe="$($elevate ffprobe "$arg" 2>&1)"
|
#probe="$($elevate ffprobe "$arg" 2>&1)"
|
||||||
#echo $probe | grep -v -e '00:00:00.04' -e 'ansi' &&
|
#echo $probe | grep -v -e '00:00:00.04' -e 'ansi' &&
|
||||||
|
# Omit short videos: test $(printf "%.0f" $(ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 "$file")) -gt 4
|
||||||
# Print media infos over file infos when <2G
|
# Print media infos over file infos when <2G
|
||||||
if ! { test "$size" -lt 2000000000 && $elevate ffprobe -hide_banner "$arg" 2>&1 | grep -E "bitrate: .{3,5} " | sed 's/, start:[^,]\+,/,/'; } || $inspect
|
if ! { test "$size" -lt 2000000000 && $elevate ffprobe -hide_banner "$arg" 2>&1 | grep -E "bitrate: .{3,5} " | sed 's/, start:[^,]\+,/,/'; } || $inspect
|
||||||
then $elevate stat --format "%U:%G %A %s $(
|
then $elevate stat --format "%U:%G %A %s $(
|
||||||
|
|
|
@ -16,10 +16,10 @@ if ! test "$command"; then
|
||||||
(*sqlite*) sqldiff --summary "${files[@]}" | grep -v '0 changes, 0 inserts, 0 deletes';; # TODO syntax highlighting for INSERT/UPDATE/DELETE
|
(*sqlite*) sqldiff --summary "${files[@]}" | grep -v '0 changes, 0 inserts, 0 deletes';; # TODO syntax highlighting for INSERT/UPDATE/DELETE
|
||||||
(text/*)
|
(text/*)
|
||||||
# Use wiked-diff only for text <100KB
|
# Use wiked-diff only for text <100KB
|
||||||
if test 100000 -gt "$(stat --format=%s "${files[@]}" | paste -s -d'+' | bc)"
|
test 100000 -gt "$(stat --format=%s "${files[@]}" | paste -s -d'+' | bc)" &&
|
||||||
then wiked-diff "${files[@]}"
|
wiked-diff "${files[@]}" ||
|
||||||
else diff --color=always --unified=1 --report-identical-files "${files[@]}"
|
diff --color=always --unified=1 --report-identical-files "${files[@]}"
|
||||||
fi;;
|
;;
|
||||||
(*) diff-color --report-identical-files "${files[@]}";;
|
(*) diff-color --report-identical-files "${files[@]}";;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -11,18 +11,20 @@ highlight() { echo "[4m$1[0m"; }
|
||||||
|
|
||||||
highlight "Checking SMART with hdparm"
|
highlight "Checking SMART with hdparm"
|
||||||
# Needs sudo for read test
|
# Needs sudo for read test
|
||||||
sudo hdparm -MWAgt "$disk"
|
sudo hdparm -MWAgt "$disk" || true
|
||||||
|
|
||||||
if test $# -eq 0
|
if test $# -eq 0
|
||||||
then highlight "[1mWrite Test"
|
then highlight "[1mWrite Test"
|
||||||
sync
|
sync
|
||||||
count=100$(test $(df --output="avail" . | tail -1) -gt 999999 && echo 0 || true)
|
count=3000$(test $(df --output="avail" . | tail -1) -gt 999999 && echo 0 || true)
|
||||||
# This prevents predictions by using random, but since that is too slow we have to copy a previously created file
|
tempfile=/var/tmp/.$count
|
||||||
highlight "Preparing random bits:" &&
|
# Prevent deduplication/predictions by using random rather than zero, but since that is too slow we have to copy a previously created file
|
||||||
sudo dd status=progress if=/dev/random of=/var/tmp/tempfile bs=1M count=$count &&
|
test -s $tempfile ||
|
||||||
|
( highlight "Preparing random bits:" &&
|
||||||
|
sudo dd status=progress if=/dev/urandom of=$tempfile bs=1M count=$count ) &&
|
||||||
highlight "Copying random bits:" &&
|
highlight "Copying random bits:" &&
|
||||||
sudo dd status=progress if=/var/tmp/tempfile of=tempfile bs=1M count=$count
|
sudo dd status=progress if=$tempfile of=.$count bs=1M count=$count
|
||||||
highlight "Copying zero bits:" &&
|
highlight "Copying zero bits:" &&
|
||||||
sudo dd status=progress if=/dev/zero of=tempfile bs=1M count=$count
|
sudo dd status=progress if=/dev/zero of=.$count bs=1M count=$count
|
||||||
sudo rm tempfile
|
sudo rm .$count
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
cd "$DATA/1-projects/software-challenge/capper/gui/src/main/resources/hui/"
|
||||||
|
rm -- *
|
||||||
|
mv "$DATA/5-incubator/download"/hui_*.zip .
|
||||||
|
unzip -- *.zip
|
||||||
|
mv -- */* .
|
||||||
|
git add .
|
||||||
|
exec $SHELL
|
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Fix odd processes getting stuck
|
||||||
|
systemctl --user restart espanso &
|
||||||
|
mpdr
|
|
@ -2,9 +2,14 @@
|
||||||
# Find terms in jrnl files and turn them into tags
|
# Find terms in jrnl files and turn them into tags
|
||||||
# Check with jrnl --tags
|
# Check with jrnl --tags
|
||||||
if test $# -eq 0
|
if test $# -eq 0
|
||||||
then $0 sleep lens uni nap cry health tech read girl dev phone Zinc bike tour laptop computer PC piano faith CB Claudia Franklin Kerstin Henri Katja Erlangen Bayreuth Berlin ICF Joan
|
then
|
||||||
|
set -x
|
||||||
|
$0 sleep uni nap cry tech read dev phone bike tour laptop computer piano faith health lens Zinc \
|
||||||
|
girl CB Claudia Kerstin Turi Taura \
|
||||||
|
Erlangen Bayreuth Berlin ICF
|
||||||
|
true $?
|
||||||
else
|
else
|
||||||
for arg
|
for arg
|
||||||
do rpl "\(^\|[^@/]\)\b$arg\b" "\1@$arg" $JOURNAL/*.txt 2>/dev/null
|
do rpl "\(^\|[^@/]\)\b$arg\b" "\1@$arg" "$JOURNAL"/*.jrnl 2>/dev/null
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# Cleanup Inactive and Broken Pods
|
||||||
|
kubectl get pods --all-namespaces --no-headers |
|
||||||
|
egrep -iv 'PodInitializing|Running|ContainerCreating|Terminating' |
|
||||||
|
awk '{print "--namespace=" $1 " " $2}' |
|
||||||
|
xargs -L 1 kubectl delete pod
|
|
@ -10,7 +10,7 @@ dir="$(dirname "$1")"
|
||||||
test "$(lsattr -d "$dir" 2>/dev/null | cut -c6)" = a && setappend=true
|
test "$(lsattr -d "$dir" 2>/dev/null | cut -c6)" = a && setappend=true
|
||||||
test -z "$setappend" || sudo chattr -V -a "$dir"
|
test -z "$setappend" || sudo chattr -V -a "$dir"
|
||||||
|
|
||||||
$elevate mkdir -p $(case "$last" in (*/) echo "$last";; (*) dirname "$last";; esac)
|
$elevate mkdir -p "$(case "$last" in (*/) echo "$last";; (*) dirname "$last";; esac)"
|
||||||
$elevate mv --verbose --interactive "$@"
|
$elevate mv --verbose --interactive "$@"
|
||||||
# TODO Diff when interactive
|
# TODO Diff when interactive
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
|
||||||
|
# Extract the email address from the mailto link
|
||||||
|
mailto_link="$1"
|
||||||
|
email_address="${mailto_link#mailto:}"
|
||||||
|
|
||||||
|
# Copy the extracted email address to the clipboard
|
||||||
|
echo -n "$email_address" | xclip -selection clipboard
|
||||||
|
|
||||||
|
# Optional: Notify the user
|
||||||
|
notify-send "Email address copied to clipboard" "$email_address"
|
||||||
|
|
||||||
|
# Optional: Log the copied email addresses for debugging
|
||||||
|
echo "Copied email address: $email_address" >> ~/mailto_log.txt
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# Toggle NordVPN
|
||||||
|
nordvpn status | grep --color=never Disconnected && nordvpn connect de || nordvpn disconnect; nordvpn status
|
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/sh -e
|
#!/bin/sh -e
|
||||||
# Put system to sleep after specified number of seconds
|
# Put system to sleep after specified number of seconds
|
||||||
$(which timer || sleep) "${@:-10}"
|
mpc pause || mpdr
|
||||||
|
$(which timer || sleep) "${@:-30}"
|
||||||
systemctl suspend
|
systemctl suspend
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# Save wl clipboard image with last copied url
|
||||||
|
file="$(date +%y%m%d-%H%M%S)_$(cliphist list | grep https:// | head -1 | rev | cut -d/ -f1 | rev).png"
|
||||||
|
wl-paste >"$file"
|
||||||
|
b "$file"
|
1
.zshenv
1
.zshenv
|
@ -154,6 +154,7 @@ export CMAKE_BUILD_PARALLEL_LEVEL=${SPARE_CORES}
|
||||||
export CTEST_PARALLEL_LEVEL=${SPARE_CORES}
|
export CTEST_PARALLEL_LEVEL=${SPARE_CORES}
|
||||||
export CTEST_PROGRESS_OUTPUT=1
|
export CTEST_PROGRESS_OUTPUT=1
|
||||||
export CTEST_OUTPUT_ON_FAILURE=1
|
export CTEST_OUTPUT_ON_FAILURE=1
|
||||||
|
export CARGO_BUILD_JOBS=${SPARE_CORES}
|
||||||
|
|
||||||
# TODO move to proper place - is also called when firenvim starts
|
# TODO move to proper place - is also called when firenvim starts
|
||||||
#autolight
|
#autolight
|
||||||
|
|
Loading…
Reference in New Issue