105 lines
3.3 KiB
Bash
105 lines
3.3 KiB
Bash
|
#!/bin/bash
|
|||
|
|
|||
|
# alias bashrc='source ~/.bashrc'
|
|||
|
alias zshrc='source ~/.zshrc'
|
|||
|
alias realias='source ~/.bash_aliases'
|
|||
|
alias reload='exec ${SHELL} -l'
|
|||
|
alias sudo='sudo ' # enable aliases to be sudo’ed
|
|||
|
alias g='git'
|
|||
|
alias hosts="sudo nano /etc/hosts"
|
|||
|
alias shrug="echo '¯\_(ツ)_/¯' | xclip -selection c"
|
|||
|
|
|||
|
alias ..='cd ..' # zsh builtin
|
|||
|
alias ~='cd ~' # zsh builtin
|
|||
|
# alias "--"='cd -' # zsh builtin
|
|||
|
|
|||
|
alias chmod='chmod --preserve-root'
|
|||
|
alias chown='chown --preserve-root'
|
|||
|
|
|||
|
alias free='free -h'
|
|||
|
alias duh='du -ha --max-depth=1'
|
|||
|
alias sduh='sudo du -ha --max-depth=1'
|
|||
|
|
|||
|
alias l='ls -pCFh --color=auto'
|
|||
|
alias la='ls -pAFh --color=auto'
|
|||
|
alias ll='ls -palFh --color=auto'
|
|||
|
|
|||
|
alias mkdir='mkdir -pv'
|
|||
|
alias where='whereis' # zsh builtin
|
|||
|
|
|||
|
alias ps='ps auxf'
|
|||
|
alias psg='ps aux | grep -v grep | grep -i -e VSZ -e'
|
|||
|
|
|||
|
alias is='type -a'
|
|||
|
alias upgrade='sudo apt update && sudo apt upgrade -y && sudo snap refresh'
|
|||
|
alias untargz='tar -czf'
|
|||
|
alias mkcd="mkdir -p $1 && cd $1"
|
|||
|
alias cl='cd $1 && ll'
|
|||
|
alias myip='curl http://ipecho.net/plain; echo'
|
|||
|
alias ports='netstat -tulpan'
|
|||
|
|
|||
|
alias ssh.pub='cat ~/.ssh/*.pub'
|
|||
|
alias gpg.new="gpg --full-generate-key"
|
|||
|
alias gpg.pub="gpg --armor --export $@"
|
|||
|
alias gpg.list='gpg --list-keys --keyid-format SHORT'
|
|||
|
|
|||
|
alias lite-xl="LITE_SCALE=1 lite-xl"
|
|||
|
alias wine='LANG=ru_RU.utf8 wine'
|
|||
|
alias docker.prune='docker image prune -f; docker network prune -f; docker container prune -f'
|
|||
|
|
|||
|
# https://obsproject.com/forum/threads/how-to-start-virtual-camera-without-sudo-privileges.139783/
|
|||
|
alias obscam="sudo modprobe v4l2loopback video_nr=2 card_label='OBS Virtual Camera'"
|
|||
|
|
|||
|
curltime() {
|
|||
|
curl -w @- -o /dev/null -s "$@" <<'EOF'
|
|||
|
time_namelookup: %{time_namelookup} sec\n
|
|||
|
time_connect: %{time_connect} sec\n
|
|||
|
time_appconnect: %{time_appconnect} sec\n
|
|||
|
time_pretransfer: %{time_pretransfer} sec\n
|
|||
|
time_redirect: %{time_redirect} sec\n
|
|||
|
time_starttransfer: %{time_starttransfer} sec\n
|
|||
|
---------------\n
|
|||
|
time_total: %{time_total} sec\n
|
|||
|
EOF
|
|||
|
}
|
|||
|
|
|||
|
# Download music from Youtube or Youtube Music
|
|||
|
# and save as top quality flac file without video
|
|||
|
# Playlist and video/track URLs are supported
|
|||
|
# Usage: $ ytm https://www.youtube.com/watch\?v=dQw4w9WgXcQ
|
|||
|
# More info: https://github.com/ytdl-org/youtube-dl
|
|||
|
ytm() {
|
|||
|
youtube-dl \
|
|||
|
--extract-audio \
|
|||
|
--audio-format flac \
|
|||
|
--audio-quality 0 \
|
|||
|
--format bestaudio \
|
|||
|
--write-info-json \
|
|||
|
--output "${HOME}/Музыка/ytm/%(playlist_title)s/%(channel)s - %(title)s.%(ext)s" \
|
|||
|
$@
|
|||
|
}
|
|||
|
|
|||
|
docker.ip() {
|
|||
|
if [ "$1" ]; then
|
|||
|
if [ "$1" = "-a" ]; then
|
|||
|
docker ps -aq \
|
|||
|
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
|
|||
|
| sed -e 's#^/##' \
|
|||
|
| column -t
|
|||
|
elif [ "$1" = "-c" ]; then
|
|||
|
docker-compose ps -q \
|
|||
|
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
|
|||
|
| sed -e 's#^/##' \
|
|||
|
| column -t
|
|||
|
else
|
|||
|
docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$1"
|
|||
|
docker port "$1"
|
|||
|
fi
|
|||
|
else
|
|||
|
docker ps -q \
|
|||
|
| xargs -n 1 docker inspect --format '{{.Name}}{{range .NetworkSettings.Networks}} {{.IPAddress}}{{end}}' \
|
|||
|
| sed -e 's#^/##' \
|
|||
|
| column -t
|
|||
|
fi
|
|||
|
}
|