LQY's Blog
Share anything
Homepage
About
incomplete projects
Categories
Archived by month
Useful tags
my config
2023-04-13 |robot | Miscellaneous

zsh
mpv

/etc/zsh/zshrc.local

prompt grml-large
source /usr/share/autojump/autojump.zsh
alias md='mkdir'
#setopt noextendedhistory
#setopt nosharehistory
# global zshrc.local modified on top of /etc/skel/.zshrc
alias p='ping'
## Inform users about upgrade path for grml's old zshrc layout, assuming that:
## /etc/skel/.zshrc was installed as ~/.zshrc,
## /etc/zsh/zshrc was installed as ~/.zshrc.global and
## ~/.zshrc.local does not exist yet.
if [ -r ~/.zshrc -a -r ~/.zshrc.global -a ! -r ~/.zshrc.local ] ; then
    printf '-!-\n'
    printf '-!- Looks like you are using the old zshrc layout of grml.\n'
    printf '-!- Please read the notes in the grml-zsh-refcard, being'
    printf '-!- available at: http://grml.org/zsh/\n'
    printf '-!-\n'
    printf '-!- If you just want to get rid of this warning message execute:\n'
    printf '-!-        touch ~/.zshrc.local\n'
    printf '-!-\n'
fi

function fixperm {
  sudo chown -R liu:liu ./
  sudo find ./ -type d -exec chmod 750 {} \;
  sudo find ./ -type f -exec chmod 640 {} \;

}
function fixpermiso {
  sudo chown -R iso:liu ./
  sudo find ./ -type d -exec chmod 770 {} \;
  sudo find ./ -type f -exec chmod 660 {} \;
}
## Prompt theme extension ##
# Virtualenv support
function virtual_env_prompt () {
    REPLY=${VIRTUAL_ENV+(${VIRTUAL_ENV:t}) }
}
#if ! grml_theme_has_token virtual-env; then
grml_theme_add_token  virtual-env -f virtual_env_prompt '%F{magenta}' '%f'
zstyle ':prompt:grml:left:setup' items rc virtual-env change-root user at host path vcs percent
#fi


## ZLE tweaks ##

## use the vi navigation keys (hjkl) besides cursor keys in menu completion
#bindkey -M menuselect 'h' vi-backward-char        # left
#bindkey -M menuselect 'k' vi-up-line-or-history   # up
#bindkey -M menuselect 'l' vi-forward-char         # right
#bindkey -M menuselect 'j' vi-down-line-or-history # bottom

## set command prediction from history, see 'man 1 zshcontrib'
is4 && zrcautoload predict-on && \
zle -N predict-on         && \
zle -N predict-off        && \
bindkey "^X^Z" predict-on && \
bindkey "^Z" predict-off

## press ctrl-q to quote line:
mquote () {
      zle beginning-of-line
      zle forward-word
      # RBUFFER="'$RBUFFER'"
      RBUFFER=${(q)RBUFFER}
      zle end-of-line
}
zle -N mquote && bindkey '^q' mquote

## define word separators (for stuff like backward-word, forward-word, backward-kill-word,..)
#WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
#WORDCHARS=.
#WORDCHARS='*?_[]~=&;!#$%^(){}'
#WORDCHARS='${WORDCHARS:s@/@}'

# just type '...' to get '../..'
rationalise-dot() {
local MATCH
if [[ $LBUFFER =~ '(^|/| |      |'$'\n''|\||;|&)\.\.$' ]]; then
  LBUFFER+=/
  zle self-insert
  zle self-insert
else
  zle self-insert
fi
}
zle -N rationalise-dot
bindkey . rationalise-dot
## without this, typing a . aborts incremental history search
bindkey -M isearch . self-insert

#bindkey '\eq' push-line-or-edit

## some popular options ##

## add `|' to output redirections in the history
#setopt histallowclobber

## try to avoid the 'zsh: no matches found...'
#setopt nonomatch

## warning if file exists ('cat /dev/null > ~/.zshrc')
#setopt NO_clobber

## don't warn me about bg processes when exiting
#setopt nocheckjobs

## alert me if something failed
setopt printexitvalue

## with spelling correction, assume dvorak kb
#setopt dvorak

## Allow comments even in interactive shells
#setopt interactivecomments

## global aliases (for those who like them) ##

#alias -g '...'='../..'
#alias -g '....'='../../..'
#alias -g BG='& exit'
#alias -g C='|wc -l'
#alias -g G='|grep'
#alias -g H='|head'
#alias -g Hl=' --help |& less -r'
#alias -g K='|keep'
#alias -g L='|less'
#alias -g LL='|& less -r'
#alias -g M='|most'
#alias -g N='&>/dev/null'
#alias -g R='| tr A-z N-za-m'
#alias -g SL='| sort | less'
#alias -g S='| sort'
#alias -g T='|tail'
#alias -g V='| vim -'

## instead of global aliase it might be better to use grmls $abk assoc array, whose contents are expanded after pressing ,.
#$abk[SnL]="| sort -n | less"

## get top 10 shell commands:
alias top10='print -l ${(o)history%% *} | uniq -c | sort -nr | head -n 10'

## Execute \kbd{./configure}
#alias CO="./configure"

## Execute \kbd{./configure --help}
#alias CH="./configure --help"

## miscellaneous code ##

## Use a default width of 80 for manpages for more convenient reading
#export MANWIDTH=${MANWIDTH:-80}

## Set a search path for the cd builtin
#cdpath=(.. ~)


# List all occurrences of programm in current PATH
plap() {
    emulate -L zsh
    if [[ $# = 0 ]] ; then
        echo "Usage:    $0 program"
        echo "Example:  $0 zsh"
        echo "Lists all occurrences of program in the current PATH."
    else
        ls -l ${^path}/*$1*(*N)
    fi
}

# Find out which libs define a symbol
lcheck() {
    if [[ -n "$1" ]] ; then
        nm -go /usr/lib/lib*.a 2>/dev/null | grep ":[[:xdigit:]]\{8\} . .*$1"
    else
        echo "Usage: lcheck <function>" >&2
    fi
}

# print hex value of a number
hex() {
    emulate -L zsh
    if [[ -n "$1" ]]; then
        printf "%x\n" $1
    else
        print 'Usage: hex <number-to-convert>'
        return 1
    fi
}

## log out? set timeout in seconds...
## ...and do not log out in some specific terminals:
#if [[ "${TERM}" == ([Exa]term*|rxvt|dtterm|screen*) ]] ; then
#    unset TMOUT
#else
#    TMOUT=1800
#fi


#bindkey "^[[1;3C" forward-word
#bindkey "^[[1;3D" backward-word
WORDCHARS='*?_-.[]~=/&;!#$%^(){}<>' # the default
#WORDCHARS='${WORDCHARS:s@/@}'

#alias sudo='sudo -v; sudo '
alias sudo='sudo '

alias una='uname -a'

# general
alias jb0='journalctl -b 0'
alias jb1='journalctl -b -1'
alias ju='journalctl -u'
alias jxe='journalctl -xe'
alias jxeu='journalctl -xeu'
alias jctl='journalctl'
alias chatpi="sudo chattr +i"
alias chatmi="sudo chattr -i"

alias status="systemctl status "
alias stop="sudo systemctl stop "
alias sto="sudo systemctl stop "
alias start="sudo systemctl start"
alias sta="sudo systemctl start"
alias restart="sudo systemctl restart "
alias res="sudo systemctl restart "
alias reload="sudo systemctl reload "
alias rel="sudo systemctl reload "
alias senable="sudo systemctl enable"
alias sen="sudo systemctl enable"
alias disable="sudo systemctl disable "
alias dis="sudo systemctl disable "
alias dmreload="sudo systemctl daemon-reload"
alias dmr="sudo systemctl daemon-reload"

alias shiber="sudo systemctl hibernate"
alias ssus="sudo systemctl suspend"

alias dmesgw='sudo dmesg -w'
function dmesgi {
    sudo dmesg|grep -i $1
}

alias i7z='sudo i7z'
alias powertop='sudo powertop'
alias dmesg='sudo dmesg'
alias iotop="sudo iotop"
alias iftop="sudo iftop"
alias nethogs="sudo nethogs"
alias suv="sudo vim"
alias lsp="sudo netstat -tunlp"

alias smi='watch -n1 "  nvidia-smi"'
alias gputemp="nvidia-smi --query-gpu=temperature.gpu --format=csv,noheader"
alias cpumon='watch -n1 " cat /proc/cpuinfo | grep MHz"'
alias mmon='watch -n1 "free -h"'
alias nmon='watch -n1 "ip a"'
alias cmon='watch -n1 "sensors|grep C"'

#alias ipa='/usr/bin/ip a -color=auto'
alias ipa='ip a'
alias checkreboot=' last -x|head -30'
alias netsp='vnstat -l -ru'
alias edho="sudo vim /etc/hosts"
alias edrc="sudo vim /etc/zsh/zshrc.local; source /etc/zsh/zshrc"
alias ednf="sudo vim /etc/nftables.conf ; restart nftables.service"
#alias edrc="kate /etc/zsh/zshrc.local ||  vim /etc/zsh/zshrc.local"
alias edrcc="sudo vim /etc/zsh/zsh-user-credential"
alias edsrc="kate ~/.ssh/config ||  vim ~/.ssh/config"
alias edrs="sudo chattr -i /etc/resolv.conf;sudo vim /etc/resolv.conf;sudo chattr +i /etc/resolv.conf"
alias edfi="sudo chattr -i /etc/firejail/firecfg.config;sudo vim /etc/firejail/firecfg.config;sudo chattr +i /etc/firejail/firecfg.config && sudo firecfg"
alias edhs="kate ~/.zsh_history  ||  vim ~/.zsh_history"
alias startvncold="vncserver -geometry 1920x1080 --nevershared -localhost yes"
alias choroot='sudo chown -R root:root '
alias pamunlock='faillock; faillock --reset; faillock'

alias lsf='ls -p | grep -v /'
# lsd already in grml-zsh-config

alias zcompressdeb='tar --use-compress-program zstd -cvf '
alias zdecompressdeb='tar --use-compress-program zstd -xvf '
function zcompress {
    tar cf - $2 | zstd --threads=0 > $1
}
function zcompress-single {
    tar cf - $2 | zstd > $1
}
alias zdecompress="tar -I zstd -xvf "
#alias 7zenc='7z a -mhe=on X.7z X -pPASS'
alias 7zenc='7z a -mhe=on '
#alias 7zencnoc='7z a -mhe=on -m0=Copy X.7z X -pPASS'
alias 7zencnoc='7z a -mhe=on -m0=Copy '

alias enforegitignore='git rm -r --cached . && git add . && git commit -am "Remove ignored files"'
alias clone="git clone  --recursive "
alias gpp='eval "$(ssh-agent -s)" &&  ssh-add ~/.ssh/${github_credential}'
# You must be using an SSH URL to check out code, check .git/config and ensure url = git@github.com:yourAccount/yourProject.git
# https://docs.github.com/en/developers/overview/using-ssh-agent-forwarding
alias gp='git push -u origin main'
alias gpmaster='git push -u origin master'
alias gitupdate='git submodule sync --recursive; git submodule foreach -q git config remote.origin.url; git submodule update --init --recursive --remote'
alias grv='git remote -v'
alias gitreset='git fetch origin && git reset --hard origin/master || git reset --hard origin/main'

alias sshkeygenlfmd5='ssh-keygen -l -E md5 -f /etc/ssh/ssh_host_rsa_key.pub '
alias sshkeygenllf='ssh-keygen -l -f /etc/ssh/ssh_host_ed25519_key.pub '
alias sshkeygen='cd ~/.ssh && ssh-keygen -t ed25519 '

alias lt='ls -l --color=auto -v -t'
function cdls() {
  cd "$1";
  ls ./
}
alias pg='ps aux|grep '
alias lg='ls|grep '

# define this before traceroute: tp, tp6, mt
alias ipmark='python /usr/bin/lily/ipmarkup'
function di {
        dig $1|ipmark
}
function mt {
    mtr $1|ipmark
}
function tp {
    traceroute $1|ipmark
}
function tp6 {
    traceroute -6 $1|ipmark
}

function dnsmon {
    dev=$1
    if [ -z "$1"]; then
        dev=wlo1
    fi
    sudo /opt/liu/bin/capture-dns $dev | ipmark
}
function ipm {
    echo $1 | python3 /usr/bin/lily/ipmarkup
}


function fdn {
    find ./ -name '*'$1'*'
}
function fddn {
    find ./ -type d -name '*'$1'*'
}
function fdnclean {
    find ./ -name '*'$1'*'  2> /dev/null 

}
function duhm {
    du -h --max-depth=1 $1 | sort -h
}
function duhmclean {
    du -h --max-depth=1 $1 2>/dev/null | sort -h
}
function duh {
    folder=$1
    if [ -z "$1"]; then
        folder=.
    fi
    echo ${folder}
    du -hs ${folder}/* | sort -h
}
function duhh {
    folder=$1
    if [ -z "$1"]; then
        folder=.
    fi
    echo ${folder}
    du -hs ${folder}/** | sort -h
}


function finddupname {
    # and the following 2 are from https://www.baeldung.com/linux/finding-duplicate-files
    awk -F'/' '{
    f = $NF
    a[f] = f in a? a[f] RS $0 : $0
    b[f]++ }
    END{for(x in b)
            if(b[x]>1)
            printf "Duplicate Filename: %s\n%s\n",x,a[x] }' <(find . -type f)
}
function finddupsha1 {
    awk '{
        sha1=$1
        a[sha1]=sha1 in a ? a[sha1] RS $2 : $2
        b[sha1]++ }
        END{for(x in b)
                if(b[x]>1)
            printf "Duplicate Files (MD5:%s):\n%s\n",x,a[x] }' <(find . -type f -exec sha1sum {} +)
}
function finddupsize {
    awk '{
        size = $1
        a[size]=size in a ? a[size] RS $2 : $2
        b[size]++ }
        END{for(x in b)
                if(b[x]>1)
                printf "Duplicate Files By Size: %d Bytes\n%s\n",x,a[x] }' <(find . -type f -exec du -b {} +)
}
function optip {
    echo 'Optimize all png and jpg files'
    find "$1" -maxdepth 1 -type f -name "*.png" -exec sh -c "oxipng -o 4 -i 1 --strip safe '{}' " \;
    find "$1" -maxdepth 1 -type f -name "*.PNG" -exec sh -c "oxipng -o 4 -i 1 --strip safe '{}' " \;
    find "$1" -maxdepth 1 -type f -name "*.jpg" -exec sh -c "jpegoptim '{}' " \;
    find "$1" -maxdepth 1 -type f -name "*JPG" -exec sh -c "jpegoptim '{}' " \;
}
function optipr {
    echo 'Optimize all png and jpg files recursively'
    find "$1" -type f -name "*.png" -exec sh -c "oxipng -o 4 -i 1 --strip safe '{}' " \;
    find "$1" -type f -name "*.PNG" -exec sh -c "oxipng -o 4 -i 1 --strip safe '{}' " \;
    find "$1" -type f -name "*.jpg" -exec sh -c "jpegoptim '{}' " \;
    find "$1" -type f -name "*JPG" -exec sh -c "jpegoptim '{}' " \;
}


# Python
alias nbcvt="jupyter nbconvert --to python "
alias nbcvtxsingle='find . -name "*.ipynb" -exec jupyter nbconvert --to python  {}  \;'
alias nbcvtx='find . -type f -name "*.ipynb" -print0 | parallel -0 jupyter nbconvert --to python  {}  \;'

alias piup='pip install --upgrade pip   '
alias pirr='pip install -r requirements.txt '
alias pir='pip install -r req.txt '
alias pirsingle="cat req.txt | cut -f1 -d'#' | sed '/^\s*$/d' | xargs -n 1 pip install"
alias psr='pip freeze > req.txt '
alias piupr='pip install --upgrade pip  && pip install -r requirements.txt '
alias piu='pip install --upgrade'
alias pi='pip install '
alias pie='pip install -e .'
alias psi='python setup.py install'
alias pu='pip uninstall '

alias pythis='source venv/bin/activate; which python'
function py {
    echo 'activate python venv in ~/.py/'$1
    source ~/.py/$1/bin/activate
    which python
}

function renamePythonVenv {
    # sed pip
    # grep -l 'OLDNAME' ./*/* 2>&1|grep -v direct|grep -v binary | xargs sed -i 's/OLDNAME/NEWNAME/g'
    # grep -l 'OLDNAME' ./*/*/*/*/* 2>&1|grep -v direct|grep -v binary | xargs sed -i 's/OLDNAME/NEWNAME/g'
}

# conda new env from yaml
# conda env create -f vmail.yaml
# conda env remove --name project-envXXX
# in case it fails, use:
# conda env update --file environment.yml  --prune




# GUI
alias k9v='killall -9 vlc'
alias kf='killall firefox'
function pctouch {
    touch $1 && pyc $1
}
alias unrealed='cd ~/f/UnrealEngine/Engine/Binaries/Linux; ./UnrealEditor'


# Download
alias agetx="aria2c -c -j 9 -x 9 -s 9 -k 1M --async-dns=false"
alias aget="aria2c --async-dns=false"

# Android

alias a='adb uninstall --user 0  '
alias ai='adb install'
alias au='adb uninstall  '
function apush {
    adb push $1 /sdcard/
}
function apull {
    adb pull $1
}
alias asrch='adb shell pm list packages -f | grep '
function ashot {
    adb exec-out screencap -p > ~/$1.png
}
function ainput {
    adb shell input tap $1 $2
}
function ainput16 {
    adb shell input tap $((16#$1)) $((16#$2))
}
function aloginput {
    adb shell getevent -l | grep ABS_MT_POSITION --line-buffered | awk '{a = substr($0,54,8); sub(/^0+/, "", a); b = sprintf("0x%s",a); printf("%d ",strtonum(b))}'
}

# Private extension

alias wget='wget --header="Accept: text/html" --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" '
# robust wget recurisve download 
alias wg='wget --header="Accept: text/html" --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" -nH --cut-dirs=1 -np --recursive -c --timeout=3  --waitretry=0 --tries=5 '
#--limit-rate=4m'

alias aria2c='aria2c --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" '
#--max-overall-download-limit=4M

alias curl='curl --user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36" '

# https://pytorch.org/get-started/previous-versions/
# https://www.tensorflow.org/install/pip

cuda9.2cudnn7.6(){
    export PATH=/usr/local/cuda-9.2/bin:$PATH
        export LD_LIBRARY_PATH=/usr/local/cuda-9.2/lib64:$LD_LIBRARY_PATH
}
cuda10.0cudnn7.4(){
    export PATH=/usr/local/cuda-10.0/bin:$PATH
        export LD_LIBRARY_PATH=/usr/local/cuda-10.0/lib64:$LD_LIBRARY_PATH
}
cuda10.1cudnn7.6(){
        export PATH=/usr/local/cuda-10.1/bin:$PATH
        export LD_LIBRARY_PATH=/usr/local/cuda-10.1/lib64:$LD_LIBRARY_PATH
}
cuda11.0cudnn8.0(){
    export PATH=/usr/local/cuda-11.0/bin:$PATH
        export LD_LIBRARY_PATH=/usr/local/cuda-11.0/lib64:$LD_LIBRARY_PATH
}
cuda11.2cudnn8.1(){
    export PATH=/usr/local/cuda-11.2/bin:$PATH
        export LD_LIBRARY_PATH=/usr/local/cuda-11.2/lib64:$LD_LIBRARY_PATH
}
cuda11.5cudnn8.3(){
    export PATH=/usr/local/cuda-11.5/bin:$PATH
        export LD_LIBRARY_PATH=/usr/local/cuda-11.5/lib64:$LD_LIBRARY_PATH
}

function changecudaver {
  rm /usr/local/cuda
  ln -sf /usr/local/cuda-$1 /usr/local/cuda
}

function checkvideointegritycuda {
    ffmpeg -hwaccel cuda -v error -i "$1" -f null - 2>"$1.log"
}
function checkvideointegrity {
    ffmpeg -v error -i "$1" -f null - 2>"$1.log"
}
function av1 {
    ffmpeg -i "$1" -c:a copy -c:v libsvtav1 "$1.av1.mp4"
}
function converttoav1 {
    for file in ./*; do
        ffmpeg -i "$file"  -c:v libsvtav1 "$file".av1.mp4
    done
}

alias llh='ls -lh '
function  gettbwdepracated {
    echo "TB Written: $(echo "scale=3; $(sudo /usr/sbin/smartctl -A $1 | grep "Total_LBAs_Written" | awk '{print $10}') * 512 / 1073741824 / 1024" | bc | sed ':a;s/\B[0-9]\{3\}\>/,&/;ta')"
}

function  plocate {
    sudo ls -l /proc/$1/exe
}

function cvtunix2dos {
    for a in ./*; do
        awk 'BEGIN{RS="^$";ORS="";getline;gsub("\n","\r&");print>ARGV[1]}' $a;
        #awk 'BEGIN{RS="^$";ORS="";getline;gsub("\r","");print>ARGV[1]}' $a
    done
}
function cvtdos2unix {
    for a in ./*; do
        #awk 'BEGIN{RS="^$";ORS="";getline;gsub("\n","\r&");print>ARGV[1]}' $a;
        awk 'BEGIN{RS="^$";ORS="";getline;gsub("\r","");print>ARGV[1]}' $a
    done
}


alias repaircorruptzshhistory='cd ~ && mv .zsh_history .zsh_history_old && strings .zsh_history_old > .zsh_history && fc -R .zsh_history'


function gpu {
    sudo nvidia-settings -c :1 -a '[gpu:0]/GPUFanControlState=1' -a "[fan:1]/GPUTargetFanSpeed=$1"
    sudo nvidia-settings -c :1 -a '[gpu:0]/GPUFanControlState=1' -a "[fan:0]/GPUTargetFanSpeed=$1"
}


function renamemastertomainlocal {
    git branch -m master main
    git fetch origin
    git branch -u origin/main main
    git remote set-head origin -a
}

alias nvcheck='source ~/.py/py3.9/bin/activate && cd ~/f/nvchecker && nvchecker -c  nvchecker.toml'

alias turnoffgpu='echo \_SB_.PC00.PEG1.PEGP._OFF  > /proc/acpi/call'
alias turnongpu='echo \_SB_.PC00.PEG1.PEGP._ON  > /proc/acpi/call'

alias startmon='ffmpeg -f v4l2 -video_size 1920x1080 -framerate 30 -i /dev/video0 -c:v libsvtav1  /mnt/xe/monitor/cam.webm'
alias gpuperf='echo performance > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor'

alias cb='cargo build'
alias cbr='cargo build --release'
alias stu='sudo sh -c "systemctl  stop netctl@xjtustu NetworkManager wpa_supplicant ; ip link set wlo1 down ; ip link set wlo1 up ; iw dev wlo1 connect XJTU_STU "'
alias cbrmusl='cargo build  --target x86_64-unknown-linux-musl --release'

alias cpup='sudo zsh -c "cpupower frequency-set --governor performance;  echo 0 > /sys/devices/system/cpu/cpu*/power/energy_perf_bias ; echo performance > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; echo performance > /sys/module/pcie_aspm/parameters/policy"'
alias cpus='sudo zsh -c " cpupower frequency-set --governor powersave; echo 15 > /sys/devices/system/cpu/cpu*/power/energy_perf_bias ; echo powersave > /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; echo powersupersave > /sys/module/pcie_aspm/parameters/policy"'
#alias myipg='aria2c https://bgp.he.net -o myip.html; grep -i visit myip.html | /usr/bin/lily/ipmarkup; rm myip.html'
alias myipg='cd /tmp/; rm myip.html; aria2c https://bgp.he.net -o myip.html && grep -i visit myip.html | /usr/bin/lily/ipmarkup; rm myip.html; cd -'
function cvt2mp3 {
        find ./ -name '*' -exec sh -c "ffmpeg -y -i '{}'  '{}.mp3'" \;
}
alias tailf='tail -f'
function juf {
        sudo journalctl -u $1 -f
}
alias edss='sudo vim /etc/ss-tproxy/ss-tproxy.conf       '
alias fixvaapi='cd /dev/dri; mv renderD128 renderD130   ; ln -s renderD129 renderD128 '
alias startp='startplasma-wayland'
alias mem-by-proc="ps aux | head -1; ps aux | sort -rnk 9"

#alias sc='systemctl'
alias sc='sudo systemctl '
alias scu='systemctl --user'
alias gt='/f/graftcp/graftcp '

alias bss='b3sum --num-threads 1'
alias bs='b3sum'
# tar cvf all subdirectories
alias tarsubdirs='for i in */; do tar cvf "${i%/}.tar.xz" "$i" && rm "$i" & done;'
alias open='xdg-open '
function concatts {
        for i in `\ls *.MTS | sort -V`; do echo "file '$i'"; done >> mylist.txt
        ffmpeg -f concat -i mylist.txt -c copy  video.mp4
}
function repairtmuxattach {
        sudo kill -SIGUSR1 $(pidof tmux)
}
alias psrch='pip freeze|grep '
source /etc/zsh/zsh-distro-arch

/etc/zsh/zsh-distro-arch

# zshrc.local with arch distro specific config, use source to include

# Arch
alias removeorphan="pacman -Qdt|awk '{print $1}'|xargs sudo pacman -R --noconfirm"
alias edmi="sudo vim /etc/pacman.d/mirrorlist"
alias purge="sudo pacman -R "
alias lspkg="expac --timefmt='%F %T' '%l %n' | sort -n"
alias srch='pacman -Ss '
function srchi {
    pacman -Ss $1 | grep install
}
alias pacu='sudo pacman -U '
function purgestar {
    sudo pacman -Rsn $(pacman -Qsq $1 | grep $1)
}
alias pacf='pacman -F '
alias ins='sudo pacman -S '
#alias syu.py='sudo python /opt/liu/scripts/syu.py'
alias syu='sudo pacman -Syu'
alias pcsyu='sudo proxychains pacman -Syu'
alias rsc='sudo pacman -Rsc'
alias qmq='pacman -Qmq'
alias ql="pacman -Ql "
alias qi="pacman -Qi "
alias rmpacmanlck='sudo rm /var/lib/pacman/db.lck'

alias autoremove='echo "can only be run as root"; pacman -Qtdq | pacman -Rns -'
alias sedpkgaarch64="sed -i '0,/x86_64/{s/x86_64/x86_64 aarch64/}' PKGBUILD"

function pcaur {
    mkdir ~/.pkgbuild
    cd ~/.pkgbuild
    proxychains wget https://aur.archlinux.org/cgit/aur.git/snapshot/$1.tar.gz
    tar xvf $1.tar.gz
    cd $1
    proxychains makepkg -si
}
function aur {
    export http_proxy=127.0.0.1:4099
    export https_proxy=127.0.0.1:4099
    mkdir ~/.pkgbuild
    wget https://aur.archlinux.org/cgit/aur.git/snapshot/$1.tar.gz
    tar xvf $1.tar.gz
    cd $1
    makepkg -si
    export http_proxy=""
    export https_proxy=""
}
function aurdi {
    mkdir ~/.pkgbuild
    wget https://aur.archlinux.org/cgit/aur.git/snapshot/$1.tar.gz
    tar xvf $1.tar.gz
    cd $1
    makepkg -si
}

function addPacmanGrubHook {
echo 'this is equivalent to installing `grub-hook`'
echo '
[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = File
Target = usr/lib/modules/*/vmlinuz

[Action]
Description = Updating GRUB Config
Depends = grub
When = PostTransaction
Exec = /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg
END' > /usr/share/libalpm/hooks/grub.hook
}
linux
respond-post-24

Add comments

Please add name
Please fill in valid email address
Please fill in a valid website
Please fill in content