kshrc, android st, update script
[dotfiles_afify.git] / .config / ksh / kshrc
blobe5c0d2915098da77d3242a4ccf11592752b430e7
1 #!/bin/ksh
3 alias k='clear'
4 alias mv='mv -i'
5 alias cp='cp -ir'
6 alias rm='rm -i'
7 alias mkdir='mkdir -p'
8 alias xc='xclip -sel clip'
9 alias fonts="fc-list | sed 's/^.*: //' | sort"
10 alias lsb="dmesg | egrep '^(cd|wd|sd|fd). at '"
11 alias sc="rsync -avzhe ssh --progress"
13 [ "$(uname)" = "OpenBSD" ] &&\
14 alias ls='colorls -GA' ||\
15 alias ls='ls --color=always -A'
17 alias ll='ls -lh'
19 alias wgetf="wget --tries=100 --continue --content-disposition --trust-server-names -i"
20 alias egyb=" cd ~/downloads && python /mnt/data/dev/egybest_downloader/egybest_unix.py"
21 alias dwmrc='cd /mnt/data/hports/src/dwm-6.2/ && vim config.h'
22 alias strc='cd /mnt/data/hports/src/st-0.8.2/ && vim config.h'
23 alias sl='cd /mnt/data/hports/src/slstatus/ && vim config.h'
25 alias ya="youtube-dl -i --add-metadata -f bestaudio"
27 alias yv4="youtube-dl -i --add-metadata -f 'bestvideo[height<=480]+bestaudio/best[height<=480]'"
28 alias yv7="youtube-dl -i --add-metadata -f 'bestvideo[height<=720]+bestaudio/best[height<=720]'"
30 alias yvp4="yv4 -o \"%(autonumber)s-%(title)s.%(ext)s\""
31 alias yvp7="yv7 -o \"%(autonumber)s-%(title)s.%(ext)s\""
33 [ "$(id -u)" = 0 ] && col="9m" || col="24m"
34 export PS1="\[\033[38;5;$col\]\W \033[38;5;166m\]\$(git branch --show-current 2>/dev/null)\[\033[00m\] "
36 ex(){
37 [ -f "$1" ] && case $1 in
38 *.tar.bz2) tar xjf "$1";;
39 *.tar.gz) tar xzf "$1";;
40 *.tar.xz) tar xf "$1";;
41 *.xz) xz -d "$1";;
42 *.bz2) bunzip2 "$1";;
43 *.rar) unrar x "$1";;
44 *.gz) gunzip "$1";;
45 *.tar) tar xf "$1";;
46 *.tbz2) tar xjf "$1";;
47 *.tgz) tar xzf "$1";;
48 *.zip) unzip "$1";;
49 *.7z) 7z x "$1";;
50 *.Z) uncompress "$1";;
51 *.tar.zst) tar -I zstd -xvf "$1";;
52 *) echo "'$1' cannot be extracted.";;
53 esac
56 comp(){
57 dir=$(basename "$1")
58 [ -f "$1" ] || [ -d "$1" ] && tar -czvf "$dir.tar.gz" -C "$1/.." "$dir"
61 fixp(){
62 [ -f "$1" ] || [ -d "$1" ] &&
63 find "$1" -type d -exec chmod 700 {} \; &&
64 find "$1" -type f -exec chmod 600 {} \; &&
65 chown -R $USER "$1" && chgrp -R $USER "$1"