dots/.alias_zsh

372 lines
11 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/bash
# Стеганография
# cat molot-tora.mp4 eraz.zip > data.mp4
# unzip date.mp4
# git.io custom url
# curl -i https://git.io -F "url=https://github.com/creio" -F "code=YOUR_CUSTOM_NAME"
alias sz="source $HOME/.zshrc"
alias ez="$EDITOR $HOME/.zshrc"
alias ea="$EDITOR $HOME/.alias_zsh"
alias merge="xrdb -merge $HOME/.Xresources"
alias xcolor="xrdb -query | grep"
alias vga="lspci -k | grep -A 2 -E '(VGA|3D)'"
alias upgrub="sudo grub-mkconfig -o /boot/grub/grub.cfg"
alias iip="curl --max-time 10 -w '\n' http://ident.me"
alias tb="nc termbin.com 9999 | xsel -b -i"
alias speed="curl -s https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py | python -"
alias updir="LC_ALL=C xdg-user-dirs-update --force"
alias dmrun="dmenu_run -l 10 -p 'app>' -fn 'ClearSansMedium 9' -nb '#282c37' -nf '#93a1a1' -sb '#5a74ca' -sf '#fff'"
doiso() {
rsync -auvCL ~/ctlosiso/out/ cretm@${dev_ctlos_ru}:~/app/dev.ctlos.ru/iso/$1
}
# blur img: blur 4 .wall/wl3.jpg blur.jpg
blur() {
convert -filter Gaussian -blur 0x$1 $2 $3
}
tbg() {
urxvt -bg '[0]red' -b 0 -depth 32 +sb -name urxvt_bg &
}
# fzf
zzh() {
du -a ~/ | awk '{print $2}' | fzf | xargs -r $EDITOR
}
zz() {
du -a . | awk '{print $2}' | fzf | xargs -r $EDITOR
}
zzd() {
du -a $1 | awk '{print $2}' | fzf | xargs -r $EDITOR
}
zzb() {
find -H "/usr/bin" "$HOME/.bin" -executable -print | sed -e 's=.*/==g' | fzf | sh
}
# зависимость source-highlight
hcat () {
/usr/bin/src-hilite-lesspipe.sh "$1" | less -m -N
}
# share vbox В локальной машине mkdir vboxshare
# в виртуалке uid={имя пользователя} git={группа}
vboxshare () {
mkdir vboxshare
sudo mount -t vboxsf -o rw,uid=1000,gid=1000 vboxshare vboxshare
# sudo mount -t vboxsf -o rw,uid=st,gid=users vboxshare vboxshare
}
# shre qemu
vmshare () {
mkdir vmshare
sudo mount -t 9p -o trans=virtio,version=9p2000.L /vmshare vmshare
}
# aur pkg
amake () {
git clone https://aur.archlinux.org/"$1".git
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
cd $1
makepkg -s
# makepkg -s --sign
cd ..
}
# aur clean chroot manager
accm () {
git clone https://aur.archlinux.org/"$2".git
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
# tar -xvf $1.tar.gz
cd $2
sudo ccm "$1" &&
gpg --detach-sign "$2"-*.pkg*
cd ..
}
# pkg clean chroot manager
lccm () {
sudo ccm "$1" &&
gpg --detach-sign *.pkg*
}
aget () {
git clone https://aur.archlinux.org/"$1".git
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
# tar -xvf $1.tar.gz
cd $1
}
# build and install pkg from aur
abuild () {
cd ~/.build
git clone https://aur.archlinux.org/"$1".git
# curl -fO https://aur.archlinux.org/cgit/aur.git/snapshot/"$1".tar.gz
# tar -xvf $1.tar.gz
cd $1
makepkg -si --skipinteg
cd ~
# rm -rf ~/.build/$1 ~/.build/$1.tar.gz
rm -rf ~/.build/$1
}
alias neofetch="neofetch --ascii ~/.config/neofetch/ctlos"
alias neoa="neofetch --ascii ~/.config/neofetch/mario"
alias neo="neofetch --w3m ~/.config/neofetch/cn.jpg"
# alias neo="neofetch --kitty ~/.config/neofetch/cn.jpg"
# alias neo="neofetch --w3m"
# Погода, не только по городу, но и по месту. Нет привязки к регистру и языку.
# alias wtr="curl 'wttr.in/Москва?M&lang=ru'"
# alias wtr="curl 'wttr.in/Москва?M&lang=ru' | sed -n '1,17p'"
# alias wtr="curl 'wttr.in/?M1npQ&lang=ru'"
wtr () {
# curl "wttr.in/?M$1npQ&lang=ru"
curl "wttr.in/Gomel?M$1npQ&lang=ru"
}
wts () {
curl "wttr.in/$1?M&lang=ru"
}
alias moon="curl 'wttr.in/Moon'"
alias srm="sudo rm -rf"
alias rm="rm -rf"
alias dir="dir --color=auto"
alias vdir="vdir --color=auto"
alias grep="grep --color=always"
#alias grep="grep --color=auto"
alias fgrep="fgrep --color=auto"
alias egrep="egrep --color=auto"
alias ls="ls --color=auto"
alias la="ls -alFh --color=auto"
alias llp="stat -c '%A %a %n' {*,.*}"
alias ll="ls -a --color=auto"
alias l="ls -CF --color=auto"
alias .l="dirs -v"
alias lss="ls -sh | sort -h"
alias duh="du -d 1 -h | sort -h"
alias mk="mkdir"
mkj () {
mkdir -p "$1"
cd "$1"
}
alias /="cd /"
alias ~="cd ~"
alias ..="cd .."
alias ...="cd ../.."
# alias ....="cd ../../.."
# alias .....="cd ../../../.."
alias q="exit"
alias gh="cd /media/files/github"
alias ctliso="cd /media/files/github/ctlosiso"
alias wiki="cd /media/files/github/wiki"
alias ghc="cd /media/files/github/creio"
alias dot="cd /media/files/github/creio/dots"
gc () {
git clone "$1"
}
function gcj () {
git clone "$1"
cd "$2"
# $EDITOR .
}
alias gi="git init"
alias gs="git status"
alias gl="git log --stat --pretty=oneline --graph --date=short"
alias gg="gitg &"
alias ga="git add --all"
gac () {
git add --all
git commit -am "$1"
}
alias gr="git remote"
alias gf="git fetch"
alias gpl="git pull"
alias gp="git push"
alias gpm="git push origin master"
alias ghab="$BROWSER http://github.com/ctlos &"
# yarn global add github-search-repos-cli
alias gsc="github-search-repos -i"
# tor chromium
alias torc="$BROWSER --proxy-server='socks://127.0.0.1:9050' &"
alias psi="$BROWSER --proxy-server='socks://127.0.0.1:1081' &"
# full screen flags -fs
alias yt="straw-viewer"
ytv () {
straw-viewer "$1"
}
# youtube-dl --ignore-errors -o '~/Видео/youtube/%(playlist)s/%(title)s.%(ext)s' https://www.youtube.com/playlist?list=PL-UzghgfytJQV-JCEtyuttutudMk7
# Загрузка Видео ~/Videos или ~/Видео
# Пример: dlv https://www.youtube.com/watch?v=gBAfejjUQoA
dlv () {
youtube-dl --ignore-errors -o '~/Videos/youtube/%(title)s.%(ext)s' "$1"
}
# dlp https://www.youtube.com/playlist?list=PL-UzghgfytJQV-JCEtyuttutudMk7
dlp () {
youtube-dl --ignore-errors -o '~/Videos/youtube/%(playlist)s/%(title)s.%(ext)s' "$1"
}
# Загрузка аудио ~/Music или ~/Музыка
# Пример: mp3 https://www.youtube.com/watch?v=gBAfejjUQoA
mp3 () {
youtube-dl --ignore-errors -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o '~/Music/youtube/%(title)s.%(ext)s' "$1"
}
# mp3p https://www.youtube.com/watch?v=-F7A24f6gNc&list=RD-F7A24f6gNc
mp3p () {
youtube-dl --ignore-errors -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 -o '~/Music/youtube/%(playlist)s/%(title)s.%(ext)s' "$1"
}
alias porn="mpv 'http://www.pornhub.com/random'"
alias mvis="ncmpcpp -S visualizer"
alias m="ncmpcpp"
pf () {
peerflix "$1" --mpv
}
alias rss="newsboat"
# download web site
wgetw () {
wget -rkx "$1"
}
iso () {
sudo dd bs=4M if="$1" of=/dev/"$2" status=progress && sync
}
alias -s {mp3,m4a,flac}="mpv"
alias -s {png,jpg,tiff,bmp}="viewnior"
# alias -s {conf,txt}="nvim"
# alias {aurman,pikaur,trizen,yaourt}="yay"
alias mi="micro"
alias smi="sudo micro"
alias st="subl3"
alias sst="sudo subl3"
alias tm="tmux attach || tmux new -s work"
alias tmd="tmux detach"
alias tmk="tmux kill-server"
alias fm="ranger"
alias sfm="sudo ranger"
alias th="thunar . &"
alias sth="sudo thunar &"
alias na="nautilus . &"
alias sna="sudo nautilus &"
alias h="htop"
# alias {v,vi,vim}="nvim"
# LANG=C pacman -Sl | awk '/\[installed\]$/ {print $2}' > ~/.pkglist.txt
# LANG=C pacman -Sl | awk '/\[installed\]$/ {print $1 "/" $2 "-" $3}' > ~/.pkglist.txt
alias pkglist="pacman -Qneq > ~/.pkglist.txt"
alias aurlist="pacman -Qmeq > ~/.aurlist.txt"
alias packey="sudo pacman-key --init && sudo pacman-key --populate && sudo pacman-key --refresh-keys && sudo pacman -Syy"
alias sp="sudo pacman -S"
alias spo="sudo pacman -S --overwrite='*'"
alias spl="sudo pacman -S --noconfirm --needed - < ~/.pkglist.txt"
alias spU="sudo pacman -U"
alias spoU="sudo pacman -U --overwrite='*'"
alias sps="sudo pacman -Ss"
alias spc="sudo pacman -Sc"
alias spcc="sudo pacman -Scc"
alias spy="sudo pacman -Syy"
alias spu="sudo pacman -Syu"
alias spr="sudo pacman -R"
alias pres="pacman -Qqn | sudo pacman -S -"
alias y="yay -S"
alias yn="yay -S --noconfirm"
alias yl="yay -S --noconfirm --needed - < ~/.aurlist.txt"
alias ys="yay"
alias ysn="yay --noconfirm"
alias yc="yay -Sc"
alias ycc="yay -Scc"
alias yy="yay -Syy"
alias yu="yay -Syu"
alias yun="yay -Syu --noconfirm"
alias yr="yay -R"
alias yrs="yay -Rs"
alias yrsn="yay -Rsn"
alias yrsnp="yay -Rsn $(pacman -Qdtq)"
alias yrn="yay -R --noconfirm"
alias yskip="yay --mflags '--nocheck --skippgpcheck --noconfirm'"
alias ynskip="yay --mflags --skipinteg --noconfirm"
# systemd
alias sse="sudo systemctl enable"
alias ssd="sudo systemctl disable"
alias ssen="sudo systemctl enable --now"
alias ssdn="sudo systemctl disable --now"
alias ssr="sudo systemctl restart"
alias ssk="sudo systemctl stop"
alias sss="sudo systemctl status"
# Python
alias ve="virtualenv ve"
alias vea="source ve/bin/activate"
alias ved="deactivate"
alias pipr="pip install -r requirements.txt"
# распаковать архив не указывая тип распаковщика
function ex {
if [ -z "$1" ]; then
# display usage if no parameters given
echo "Использование: ex <path/file_name>.<zip|rar|bz2|gz|tar|tbz2|tgz|Z|7z|xz|ex|tar.bz2|tar.gz|tar.xz>"
else
if [ -f "$1" ] ; then
NAME=${1%.*}
#mkdir $NAME && cd $NAME
case "$1" in
*.tar.bz2) tar xvjf ./"$1" ;;
*.tar.gz) tar xvzf ./"$1" ;;
*.tar.xz) tar xvJf ./"$1" ;;
*.lzma) unlzma ./"$1" ;;
*.bz2) bunzip2 ./"$1" ;;
*.rar) unrar x -ad ./"$1" ;;
*.gz) gunzip ./"$1" ;;
*.tar) tar xvf ./"$1" ;;
*.tbz2) tar xvjf ./"$1" ;;
*.tgz) tar xvzf ./"$1" ;;
*.zip) unzip ./"$1" ;;
*.Z) uncompress ./"$1" ;;
*.7z) 7z x ./"$1" ;;
*.xz) unxz ./"$1" ;;
*.exe) cabextract ./"$1" ;;
*) echo "ex: '$1' - Не может быть распакован" ;;
esac
else
echo "'$1' - не является допустимым файлом"
fi
fi
}
# Упаковка в архив командой pk 7z /что/мы/пакуем имя_файла.7z
function pk () {
if [ $1 ] ; then
case $1 in
tbz) tar cjvf $2.tar.bz2 $2 ;;
tgz) tar czvf $2.tar.gz $2 ;;
txz) tar -caf $2.tar.xz $2 ;;
tar) tar cpvf $2.tar $2 ;;
bz2) bzip $2 ;;
gz) gzip -c -9 -n $2 > $2.gz ;;
zip) zip -r $2.zip $2 ;;
7z) 7z a $2.7z $2 ;;
*) echo "'$1' не может быть упакован с помощью pk()" ;;
esac
else
echo "'$1' не является допустимым файлом"
fi
}