Alias cleanup
This commit is contained in:
parent
96b406b8d7
commit
f8e906c634
@ -1,7 +1,6 @@
|
||||
# Simple shell aliasing
|
||||
|
||||
alias emacs="TERM=screen-256color emacsclient -t"
|
||||
alias sumacs="sudo emacs -nw"
|
||||
|
||||
alias systemctl="sudo systemctl"
|
||||
alias userctl="\systemctl --user"
|
||||
@ -14,10 +13,7 @@ alias cp="cp -i --reflink=auto"
|
||||
alias mv="mv -i"
|
||||
alias rm="rm -i"
|
||||
|
||||
alias screenclip="scrot -o >(xclip -sel clip -t image/png)"
|
||||
|
||||
alias virsh="\virsh -c qemu:///system"
|
||||
alias sandbox-virsh="\virsh -c qemu+ssh://sandbox/system"
|
||||
|
||||
alias ls='ls --color=tty'
|
||||
alias ll='ls -lh'
|
||||
@ -32,94 +28,92 @@ alias sign='gpg --sign-with ezri@ezri.dev --detach-sign'
|
||||
alias verify='gpg --verify'
|
||||
|
||||
function didifuckingstutter {
|
||||
echo $fg[blue]Apologies, Captain. Right away.$fg[default]
|
||||
# Run the last command as root
|
||||
last_cmd=$(fc -ln -1)
|
||||
# if last command was emacs, use TRAMP rather than running as root
|
||||
if [[ $last_cmd =~ "^emacs .*" ]]; then
|
||||
cmd="emacsclient -t /sudo::$(echo $last_cmd | cut -d' ' -f2-)"
|
||||
echo "> $fg[white]$cmd$fg[default]"
|
||||
$=cmd
|
||||
else
|
||||
cmd="sudo $(fc -ln -1)"
|
||||
echo "> $fg[white]$cmd$fg[default]"
|
||||
sudo -p "$fg[red]I'll need your authorization:$fg[default] " $last_cmd
|
||||
fi
|
||||
echo $fg[blue]Apologies, right away.$fg[default]
|
||||
# Run the last command as root
|
||||
last_cmd=$(fc -ln -1)
|
||||
# if last command was emacs, use TRAMP rather than running as root
|
||||
if [[ $last_cmd =~ "^emacs .*" ]]; then
|
||||
cmd="emacsclient -t /sudo::$(echo $last_cmd | cut -d' ' -f2-)"
|
||||
echo "> $fg[white]$cmd$fg[default]"
|
||||
$=cmd
|
||||
else
|
||||
cmd="sudo $(fc -ln -1)"
|
||||
echo "> $fg[white]$cmd$fg[default]"
|
||||
sudo -p "$fg[red]I'll need your authorization:$fg[default] " $last_cmd
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
function pygrep {
|
||||
success=0
|
||||
for pid in $(pgrep python); do
|
||||
if cut -d '' -f2 < /proc/$pid/cmdline | rev | cut -d'/' -f1 | rev | grep "$1.py" &> /dev/null; then
|
||||
echo $pid
|
||||
success=1
|
||||
fi
|
||||
done
|
||||
if ! (( success )); then
|
||||
return 1
|
||||
success=0
|
||||
for pid in $(pgrep python); do
|
||||
if cut -d '' -f2 </proc/$pid/cmdline | rev | cut -d'/' -f1 | rev | grep "$1.py" &>/dev/null; then
|
||||
echo $pid
|
||||
success=1
|
||||
fi
|
||||
done
|
||||
if ! ((success)); then
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
function create-discord-timestamp {
|
||||
date --date="$(echo $@)" +'<t:%s:t>' | tee >(tr -d '\n' | cbcopy)
|
||||
date --date="$(echo $@)" +'<t:%s:t>' | tee >(tr -d '\n' | cbcopy)
|
||||
}
|
||||
|
||||
function copy-text {
|
||||
echo -n $@ | cbcopy
|
||||
echo -n $@ | cbcopy
|
||||
}
|
||||
|
||||
function cbcopy {
|
||||
x_args='-sel clip'
|
||||
if [[ $1 == '--primary' ]] || [[ $1 == '-p' ]]; then
|
||||
wl_args='--primary'
|
||||
x_args=''
|
||||
fi
|
||||
if [[ -x $(command -v wl-copy) ]]; then
|
||||
# Prioritize wayland
|
||||
wl-copy $wl_args
|
||||
return $?
|
||||
fi
|
||||
if [[ -x $(command -v xclip) ]]; then
|
||||
# Next do Xorg
|
||||
xclip $x_args
|
||||
return $?
|
||||
fi
|
||||
if [[ -x $(command -v pbcopy) ]]; then
|
||||
pbcopy
|
||||
return $?
|
||||
fi
|
||||
echo "No known clipboard commands available"
|
||||
return 1
|
||||
x_args='-sel clip'
|
||||
if [[ $1 == '--primary' ]] || [[ $1 == '-p' ]]; then
|
||||
wl_args='--primary'
|
||||
x_args=''
|
||||
fi
|
||||
if [[ -x $(command -v wl-copy) ]]; then
|
||||
# Prioritize wayland
|
||||
wl-copy $wl_args
|
||||
return $?
|
||||
fi
|
||||
if [[ -x $(command -v xclip) ]]; then
|
||||
# Next do Xorg
|
||||
xclip $x_args
|
||||
return $?
|
||||
fi
|
||||
if [[ -x $(command -v pbcopy) ]]; then
|
||||
pbcopy
|
||||
return $?
|
||||
fi
|
||||
echo "No known clipboard commands available"
|
||||
return 1
|
||||
}
|
||||
|
||||
function cbpaste {
|
||||
x_args='-sel clip'
|
||||
if [[ $1 == '--primary' ]] || [[ $1 == '-p' ]]; then
|
||||
wl_args='--primary'
|
||||
x_args=''
|
||||
fi
|
||||
if [[ -x $(command -v wl-copy) ]]; then
|
||||
# Prioritize wayland
|
||||
wl-paste $wl_args
|
||||
return $?
|
||||
fi
|
||||
if [[ -x $(command -v xclip) ]]; then
|
||||
# Next do Xorg
|
||||
xclip -o $x_args
|
||||
return $?
|
||||
fi
|
||||
if [[ -x $(command -v pbcopy) ]]; then
|
||||
pbpaste
|
||||
return $?
|
||||
fi
|
||||
echo "No known clipboard commands available" > /dev/stderr
|
||||
return 1
|
||||
x_args='-sel clip'
|
||||
if [[ $1 == '--primary' ]] || [[ $1 == '-p' ]]; then
|
||||
wl_args='--primary'
|
||||
x_args=''
|
||||
fi
|
||||
if [[ -x $(command -v wl-copy) ]]; then
|
||||
# Prioritize wayland
|
||||
wl-paste $wl_args
|
||||
return $?
|
||||
fi
|
||||
if [[ -x $(command -v xclip) ]]; then
|
||||
# Next do Xorg
|
||||
xclip -o $x_args
|
||||
return $?
|
||||
fi
|
||||
if [[ -x $(command -v pbcopy) ]]; then
|
||||
pbpaste
|
||||
return $?
|
||||
fi
|
||||
echo "No known clipboard commands available" >/dev/stderr
|
||||
return 1
|
||||
}
|
||||
|
||||
alias aggietimed='aggietimed -s /run/user/1000/aggietimed.sock -pos 190910 --action'
|
||||
|
||||
function mkcd {
|
||||
[[ -e $1 ]] || mkdir -p $1
|
||||
cd $1
|
||||
[[ -e $1 ]] || mkdir -p $1
|
||||
cd $1
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user