Compare commits
2 Commits
7470358536
...
9f0aae589a
Author | SHA1 | Date |
---|---|---|
xeruf | 9f0aae589a | |
xeruf | 99053ecd32 |
|
@ -1,10 +1,35 @@
|
||||||
test -n "$PS1" || return 0
|
test -n "$PS1" || return 0
|
||||||
|
|
||||||
alias sc="sudo systemctl"
|
test $(id -u) -eq 0 || sudo=sudo
|
||||||
alias scs="sudo systemctl status"
|
|
||||||
alias sce="sudo systemctl enable --now"
|
alias sc="$sudo systemctl"
|
||||||
alias scr="sudo systemctl reload-or-restart"
|
alias scs="$sudo systemctl status"
|
||||||
alias status="sudo systemctl list-units --failed || service --status-all; tmux ls; sudo docker ps || sudo systemctl status docker"
|
alias sce="$sudo systemctl enable --now"
|
||||||
|
alias sced="$sudo --preserve-env=EDITOR systemctl edit"
|
||||||
|
alias scr="$sudo systemctl reload-or-restart"
|
||||||
|
|
||||||
|
highlight() { echo "[4m$1[0m"; }
|
||||||
|
status() {
|
||||||
|
highlight 'System'
|
||||||
|
free -h
|
||||||
|
df -h -T --exclude-type=tmpfs --exclude-type=devtmpfs --exclude-type=squashfs --exclude-type=overlay
|
||||||
|
zfs list -d 0
|
||||||
|
highlight 'Internet'
|
||||||
|
#--color=always
|
||||||
|
ip -brief address | grep --color=none -E '^(wl|en|tun|vmbr)'
|
||||||
|
ip route
|
||||||
|
echo -n 'IPv4: ' && timeout 3s ping example.com -A -c 3 -w 3 -q -4
|
||||||
|
echo -n 'IPv6: ' && timeout 3s ping example.com -A -c 3 -w 3 -q -6
|
||||||
|
highlight 'Programs'
|
||||||
|
tmux ls
|
||||||
|
$sudo systemctl --no-pager list-units --failed || service --status-all
|
||||||
|
if type docker >/dev/null
|
||||||
|
then $sudo docker ps || $sudo systemctl status docker
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
alias u='$sudo apt update && sudo apt upgrade'
|
||||||
|
alias ur='u && $sudo reboot'
|
||||||
|
|
||||||
# Diff recursively
|
# Diff recursively
|
||||||
difr() { diff --color=always --unified=1 --recursive "$@" | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen; }
|
difr() { diff --color=always --unified=1 --recursive "$@" | less --RAW-CONTROL-CHARS --quit-on-intr --quit-if-one-screen; }
|
||||||
|
|
|
@ -12,7 +12,7 @@ indent_character: '|'
|
||||||
journals:
|
journals:
|
||||||
default: ~/data/2-box/journal/jrnl.txt
|
default: ~/data/2-box/journal/jrnl.txt
|
||||||
intentions: ~/data/2-box/journal/intentions.txt
|
intentions: ~/data/2-box/journal/intentions.txt
|
||||||
nug: ~/data/2-box/journal/nugnug.txt
|
nug: ~/data/2-box/journal/nug.txt
|
||||||
linewrap: 99
|
linewrap: 99
|
||||||
tagsymbols: '@'
|
tagsymbols: '@'
|
||||||
template: false
|
template: false
|
||||||
|
|
|
@ -316,10 +316,15 @@ sshl() {
|
||||||
local authcache="/var/tmp/ssh-keys"
|
local authcache="/var/tmp/ssh-keys"
|
||||||
mkdir -p "$authcache"
|
mkdir -p "$authcache"
|
||||||
local file="$authcache/$1"
|
local file="$authcache/$1"
|
||||||
|
ssh -G "$1" | grep --silent "^user root$" &&
|
||||||
|
! [[ "$1" =~ "pve.*" ]] &&
|
||||||
|
! [[ "$1" =~ "encee.*" ]] &&
|
||||||
|
! [[ "$1" =~ ".*fmh.de" ]] &&
|
||||||
|
pass=pass
|
||||||
test "$all" &&
|
test "$all" &&
|
||||||
pass scp ~/.bash_aliases "$1:" &&
|
$pass scp ~/.bash_aliases "$1:" &&
|
||||||
pass ssh "$1" 'grep -q ".bash_aliases" .bashrc || echo "source ~/.bash_aliases" >>.bashrc'
|
$pass ssh "$1" 'grep -q ".bash_aliases" .bashrc || echo "source ~/.bash_aliases" >>.bashrc'
|
||||||
if ssh -G "$1" | grep --silent "^user root$" && ! [[ "$1" =~ "pve*" ]]
|
if test -n "$pass"
|
||||||
then pass ssh "$@"
|
then pass ssh "$@"
|
||||||
else
|
else
|
||||||
test ! -e "$file" &&
|
test ! -e "$file" &&
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/sh -e
|
||||||
|
# Automatically set screen brightness based on time of day.
|
||||||
|
# OLD: value=$(expr 100 - $(expr 13 - $(date +%H) | tr -d -) \* 5)
|
||||||
|
# S Function: echo "(c($(date +%H) / 4 - 3) + 1) * 50" | bc -l
|
||||||
|
value=$(echo "l=(100 - 1.5 * ( 11 - $(date +%H) ) ^ 2); if(l > 0) l else 3" | bc -l)
|
||||||
|
light -S $value
|
||||||
|
{ date && echo $value; } >>/var/log/autolight
|
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# Check the first file against all other ones given and print duplicates.
|
||||||
|
# Checks first size then diff.
|
||||||
|
# TODO diff initial bytes
|
||||||
|
if ! test $# -lt 2
|
||||||
|
then echo "Need at least 2 files to compare!" 2>/dev/null
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
target="$1"
|
||||||
|
shift
|
||||||
|
for existing
|
||||||
|
do test "$(realpath "$target")" != "$(realpath "$existing")" -a -f "$existing" &&
|
||||||
|
test "$(stat --format %s "$target")" -eq "$(stat --format %s "$existing")" &&
|
||||||
|
diff -q "$target" "$existing" >/dev/null &&
|
||||||
|
echo "$existing"
|
||||||
|
#test "$(md5sum "$existing" | cut -d\ -f1)" = "$(md5sum "$filepath" | cut -d\ -f1)" &&
|
||||||
|
done
|
|
@ -1,11 +1,15 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Delete files under current or given path which exist elsewhere as listed in the locate database
|
# Delete files under current or given path
|
||||||
# Matches first by name, then by checksum (currently inefficiently via md5)
|
# which exist elsewhere as listed by locate.
|
||||||
|
# Args: [threshold (MB)] <filepaths...>
|
||||||
|
# OptDepends: synct (for checking against original filename)
|
||||||
case $1 in ([0-9]|[0-9][0-9]) threshold=$1; shift;; esac
|
case $1 in ([0-9]|[0-9][0-9]) threshold=$1; shift;; esac
|
||||||
find "$@" -size +${threshold:-50}M -type f -exec sh -c "IFS=$'\n'"'
|
find "$@" -size +${threshold:-50}M -type f -exec sh -c "IFS=$'\n'"'
|
||||||
filepath="{}"
|
filepath="{}"
|
||||||
target="$(synct-unarchive "$filepath")"
|
target="$(synct-unarchive "$filepath" || echo "$filepath")"
|
||||||
highlight "$filepath"
|
highlight "$filepath"
|
||||||
for existing in $(locate -b "$target")
|
for existing in $(locate -b "$target")
|
||||||
do test "$(realpath "$target")" != "$(realpath "$existing")" -a -f "$existing" && test "$(md5sum "$existing" | cut -d\ -f1)" = "$(md5sum "$filepath" | cut -d\ -f1)" && echo "Found duplicate at $existing" && rm -vi "$filepath" && break
|
do test -n "$(dupcheck "$target" "$existing") &&
|
||||||
|
echo "Duplicate found at $existing"
|
||||||
|
rm -vi "$filepath" && break
|
||||||
done' \;
|
done' \;
|
||||||
|
|
Loading…
Reference in New Issue