You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
312 lines
10 KiB
312 lines
10 KiB
5 months ago
|
# dominics alias file
|
||
|
# arch linux - polaris
|
||
|
# oe7drt.com / "2023-01-31T02:14:41+0100"
|
||
|
|
||
|
#alias la='ls -lah'
|
||
|
alias ..='cd ..'
|
||
|
alias ...='cd ../..'
|
||
|
alias ....='cd ../../..'
|
||
|
|
||
|
alias ducks='du -cks * | sort -rn | head'
|
||
|
alias confcat="sed -e 's/#.*//;/^\s*$/d' "$@""
|
||
|
|
||
|
alias la='ls -la'
|
||
|
alias ll='ls -l'
|
||
|
alias lh='ls -lh'
|
||
|
|
||
|
alias sc='screen -DR Hooray'
|
||
|
alias dmr='screen -DR DMR'
|
||
|
alias tm='tmux -u new-session -A -s Eve'
|
||
|
|
||
|
[[ "$EUID" -ne 0 ]] && __is_available sudo \
|
||
|
&& alias admin='sudo su' \
|
||
|
&& alias dmesg='sudo dmesg' \
|
||
|
&& alias dt='dmesg | tail -n 15' \
|
||
|
&& alias dm='tail -f /var/log/messages'
|
||
|
|
||
|
[[ "$EUID" -ne 0 ]] && __is_available doas \
|
||
|
&& alias dosa='doas' \
|
||
|
&& alias admin='doas su' \
|
||
|
&& alias dmesg='doas dmesg' \
|
||
|
&& alias dt='doas dmesg | tail -n 15' \
|
||
|
&& alias dm='tail -f /var/log/messages'
|
||
|
|
||
|
[[ -d ~/sites/oe7drt-website ]] \
|
||
|
&& alias dr='cd ~/sites/oe7drt-website'
|
||
|
|
||
|
alias wallpaper='ls ~/Bilder/backgrounds | fzf --preview="feh --bg-scale ~/Bilder/backgrounds/{}" | xargs -I {} feh --bg-scale ~/Bilder/backgrounds/{}'
|
||
|
|
||
|
function dvid {
|
||
|
if (( $(uname -n) == "odin" ) || $(uname -n == "polaris" )); then
|
||
|
ffmpeg -vaapi_device /dev/dri/renderD128 -i $1 -to $2 -c copy -movflags faststart $3
|
||
|
else
|
||
|
ffmpeg -i $1 -to $2 -c copy -movflags faststart $3
|
||
|
fi
|
||
|
}
|
||
|
|
||
|
# && alias hs="""hugo server -DEF --gc --cleanDestinationDir --printPathWarnings --logLevel debug --bind 0.0.0.0 --baseURL http://$(runit "/sbin/ifconfig | grep broadcast | head -1 | awk '{ print \$2 }'")"""
|
||
|
# && alias hs="""hugo server -DEF --gc --cleanDestinationDir --noHTTPCache --renderToMemory --disableFastRender --printPathWarnings --logLevel debug --bind 0.0.0.0 --baseURL http://$(runit "ip a | grep "/24" | head -1 | awk '{ print \$2 }' | cut -d/ -f1")"""
|
||
|
# && alias hs="""hugo server -DEF --gc --cleanDestinationDir --bind 0.0.0.0 --baseURL http://$(runit "ip a | grep "/24" | head -1 | awk '{ print \$2 }' | cut -d/ -f1")"""
|
||
|
[[ "$OS" == "linux" ]] && __is_available hugo \
|
||
|
&& function runit { eval $1; } \
|
||
|
&& alias hs="""hugo server -DEF --gc --bind 0.0.0.0 --baseURL http://$(runit "ip a | grep "/24" | head -1 | awk '{ print \$2 }' | cut -d/ -f1")""" \
|
||
|
&& alias lhs="hugo server -DEF --gc --bind 0.0.0.0 --baseURL http://127.0.0.1"
|
||
|
|
||
|
[[ "$OS" == "freebsd" ]] && __is_available hugo \
|
||
|
&& alias hs="hugo server -DEF --gc --bind 0.0.0.0 --baseURL http://10.0.0.2" \
|
||
|
&& alias lhs="hugo server -DEF --gc --bind 0.0.0.0 --baseURL http://127.0.0.1"
|
||
|
|
||
|
__is_available blacklist \
|
||
|
&& alias bl='blacklist -a'
|
||
|
|
||
|
__is_available X \
|
||
|
&& alias x=startx
|
||
|
|
||
|
__is_available picocom \
|
||
|
&& alias os='picocom -b 115200 -d 8 -y n -p 1 /dev/tty.usbmodemDADCB8841'
|
||
|
|
||
|
__is_available yt-dlp \
|
||
|
&& alias yl='yt-dlp -x --audio-format mp3 --embed-thumbnail --embed-metadata'
|
||
|
|
||
|
__is_available eza \
|
||
|
&& unalias l && unalias la \
|
||
|
&& alias l='ls -1a' && alias la='ll -a' \
|
||
|
&& function ls {
|
||
|
eza --color-scale --icons --group-directories-first $argv
|
||
|
} \
|
||
|
&& function gls {
|
||
|
eza --icons --group-directories-first --git-ignore $argv
|
||
|
} \
|
||
|
&& function gll {
|
||
|
eza --long --color-scale --icons --group-directories-first --git-ignore --git $argv
|
||
|
}
|
||
|
|
||
|
__is_available urlwatch \
|
||
|
&& function urladd {
|
||
|
ssh celeste urlwatch --add url=https://www.qrz.com/db/${1:u},diff_tool=/home/dominic/bin/qrzdiff.sh
|
||
|
}
|
||
|
|
||
|
# && alias ols='/bin/ls' && alias oll='/bin/ls -l' \
|
||
|
__is_available lsd \
|
||
|
&& alias lld='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name' \
|
||
|
&& alias lldg='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,group,size,date,name' \
|
||
|
&& alias lldga='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,group,size,date,name -a' \
|
||
|
&& alias lli='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,inode' \
|
||
|
&& alias llg='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,git' \
|
||
|
&& alias llgi='lsd --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,git,inode'
|
||
|
|
||
|
__is_available exa \
|
||
|
&& alias lld='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name' \
|
||
|
&& alias lldg='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,group,size,date,name' \
|
||
|
&& alias lldga='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,group,size,date,name -a' \
|
||
|
&& alias lli='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,inode' \
|
||
|
&& alias llg='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,git' \
|
||
|
&& alias llgi='exa --date=+"%Y-%m-%d %H:%M:%S" --group-dirs=first -v --blocks=permission,user,size,date,name,git,inode'
|
||
|
# && function ls {
|
||
|
# # list directories first and sort by version (1-$name before 10-$name)
|
||
|
# lsd --group-directories-first -v $argv
|
||
|
# }
|
||
|
|
||
|
#&& alias aconf='git --git-dir=$HOME/.cfg/ --work-tree=$HOME'
|
||
|
__is_available git && [[ -d ~/.cfg ]] \
|
||
|
&& function aconf {
|
||
|
git --git-dir=$HOME/.cfg/ --work-tree=$HOME $@
|
||
|
}
|
||
|
|
||
|
__is_available lazygit \
|
||
|
&& alias lg='lazygit'
|
||
|
|
||
|
__is_available lazygit && [[ -d ~/.cfg ]] \
|
||
|
&& alias lconf='lazygit --git-dir=$HOME/.cfg/ --work-tree=$HOME'
|
||
|
|
||
|
__is_available bat \
|
||
|
&& alias bat="bat --wrap=never"
|
||
|
# && alias bat="bat --paging always"
|
||
|
|
||
|
__is_available bat \
|
||
|
&& alias batdiff='git diff --name-only --relative --diff-filter=d | xargs bat --diff'
|
||
|
|
||
|
function nvid {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 4M -bufsize 4M -pass 1 -f null /dev/null
|
||
|
ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 4M -bufsize 4M -pass 2 ${i:t:r}-recoded.mkv
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function nvidtest {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
ffmpeg -vaapi_device /dev/dri/renderD128 -ss 10:00 -t 10:00 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 4M -bufsize 4M -pass 1 -f null /dev/null
|
||
|
ffmpeg -vaapi_device /dev/dri/renderD128 -ss 10:00 -t 10:00 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 4M -bufsize 4M -pass 2 ${i:t:r}-recoded.mkv
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function mvidgif-crop {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
ffmpeg -i "$i" -an -vf \
|
||
|
"fps=8,scale=iw*2/3:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
|
||
|
${i:t:r}_masto-crop.gif
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function mvidgif {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
ffmpeg -i "$i" -an -vf \
|
||
|
"fps=8,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" \
|
||
|
${i:t:r}-masto.gif
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function mvid-crop {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
ffmpeg -i "$i" -c:a aac -c:v libvpx-vp9 -vf \
|
||
|
"scale=iw/2*3:-1:flags=lanczos" -crf 31 -b:v 1800k \
|
||
|
-quality good -speed 0 -movflags +faststart -tune zerolatency \
|
||
|
${i:t:r}-masto-crop.webm
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function mvid {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
ffmpeg -i "$i" -c:v libvpx-vp9 -crf 31 -b:v 1800k -quality good \
|
||
|
-speed 0 -movflags +faststart ${i:t:r}-masto.webm
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function camconvert {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
ffmpeg -y -i "$i" -vf "unsharp=5:5:1.0:5:5:0.0" -an -c:v libx264 \
|
||
|
-preset slow -b:v 10000k -pass 1 -f mp4 /dev/null
|
||
|
ffmpeg -y -i "$i" -vf "unsharp=5:5:1.0:5:5:0.0" -an -c:v libx264 \
|
||
|
-preset slow -b:v 10000k -pass 2 "${i:t:r}_small.mp4"
|
||
|
rm -if ffmpeg2pass-0.log*
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function svid {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
ffmpeg -y -i "$i" -x264opts opencl -c:v libx264 -crf 23 -c:a aac \
|
||
|
-movflags +faststart -tune zerolatency -maxrate 2M -bufsize 2M \
|
||
|
${i:t:r}-small.mp4
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function webvideo {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file(s)]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 3M -bufsize 3M -pass 1 -f null /dev/null
|
||
|
ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -c:v libx264 -tune zerolatency -movflags +faststart -b:v 2M -maxrate 3M -bufsize 3M -pass 2 ${i:t:r}-web.mp4
|
||
|
ffmpeg -vaapi_device /dev/dri/renderD128 -i "$i" -c:v libvpx-vp9 -crf 31 -b:v 1800k -quality good -speed 0 -movflags +faststart ${i:t:r}-web.webm
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function opti {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
optipng -nb -nc "$i";
|
||
|
advpng -z4 "$i";
|
||
|
pngcrush -rem gAMA -rem alla -rem cHRM -rem iCCP -rem sRGB \
|
||
|
-rem time -ow "$i";
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function jopti {
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
jpegtran -copy none -optimize -progressive -outfile $i $i;
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function imgconv {
|
||
|
# Create 100% image crop from the center pic with half
|
||
|
# the size of the image
|
||
|
if (( # == 0 )); then
|
||
|
print >&2 "Usage: $0 [file]"
|
||
|
return 1
|
||
|
fi
|
||
|
for i; do
|
||
|
convert $i -resize 50% -sampling-factor 4:2:0 -strip \
|
||
|
-quality 85 -interlace JPEG -colorspace RGB ${i:t:r}@0,5.jpg;
|
||
|
convert $i -resize 25% -sampling-factor 4:2:0 -strip \
|
||
|
-quality 85 -interlace JPEG -colorspace RGB ${i:t:r}@0,25.jpg;
|
||
|
done
|
||
|
}
|
||
|
|
||
|
function ptgui() {
|
||
|
cd $HOME/bin/PTGui
|
||
|
./PTGui
|
||
|
}
|
||
|
|
||
|
function f {
|
||
|
FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git' FZF_DEFAULT_OPTS="--color=bg+:#302D41,bg:#1E1E2E,spinner:#F8BD96,hl:#F28FAD --color=fg:#D9E0EE,header:#F28FAD,info:#DDB6F2,pointer:#F8BD96 --color=marker:#F8BD96,fg+:#F2CDCD,prompt:#DDB6F2,hl+:#F28FAD --preview 'bat --style=numbers --color=always --line-range :500 {}'" fzf --height 60% --layout reverse --info inline --border --color 'border:#b48ead' $argv
|
||
|
}
|
||
|
|
||
|
function mpv {
|
||
|
#env __NV_PRIME_RENDER_OFFLOAD=1 mpv $argv
|
||
|
env mpv --vo=gpu --hwdec=vaapi $argv
|
||
|
}
|
||
|
|
||
|
__is_available bat \
|
||
|
&& alias bat="bat --wrap=never"
|
||
|
|
||
|
__is_available fastfetch \
|
||
|
&& function n {
|
||
|
fastfetch $argv
|
||
|
}
|
||
|
|
||
|
alias r='ranger'
|
||
|
|
||
|
function yl {
|
||
|
yt-dlp -x --audio-format mp3 --embed-thumbnail $argv
|
||
|
}
|
||
|
|
||
|
function ala {
|
||
|
alacritty --hold -e $argv
|
||
|
}
|
||
|
|
||
|
__is_available gs \
|
||
|
&& function pdf-combine {
|
||
|
gs -q -sPAPERSIZE=a4 -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=pdf-combined.pdf $argv
|
||
|
}
|
||
|
|