initial
This commit is contained in:
commit
4e3463691c
15
.gitmodules
vendored
Normal file
15
.gitmodules
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
[submodule "grc"]
|
||||
path = grc
|
||||
url = https://github.com/garabik/grc
|
||||
[submodule "k"]
|
||||
path = k
|
||||
url = https://github.com/supercrabtree/k
|
||||
[submodule "pure"]
|
||||
path = pure
|
||||
url = https://github.com/sindresorhus/pure
|
||||
[submodule "zsh-autosuggestions"]
|
||||
path = zsh-autosuggestions
|
||||
url = https://github.com/zsh-users/zsh-autosuggestions
|
||||
[submodule "zsh-syntax-highlighting"]
|
||||
path = zsh-syntax-highlighting
|
||||
url = https://github.com/zsh-users/zsh-syntax-highlighting
|
1
grc
Submodule
1
grc
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit f4a579e08d356a3ea00a8c6fda7de84fff5f676a
|
95
grc.zsh
Normal file
95
grc.zsh
Normal file
@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
if [ "$TERM" = dumb ] || (( ! $+commands[grc] ))
|
||||
then
|
||||
return
|
||||
fi
|
||||
|
||||
# Supported commands
|
||||
cmds=(
|
||||
as
|
||||
ant
|
||||
blkid
|
||||
cc
|
||||
configure
|
||||
curl
|
||||
cvs
|
||||
df
|
||||
diff
|
||||
dig
|
||||
dnf
|
||||
docker
|
||||
docker-compose
|
||||
docker-machine
|
||||
du
|
||||
env
|
||||
fdisk
|
||||
findmnt
|
||||
free
|
||||
g++
|
||||
gas
|
||||
gcc
|
||||
getfacl
|
||||
getsebool
|
||||
gmake
|
||||
id
|
||||
ifconfig
|
||||
iostat
|
||||
ip
|
||||
iptables
|
||||
iwconfig
|
||||
journalctl
|
||||
kubectl
|
||||
last
|
||||
ldap
|
||||
lolcat
|
||||
ld
|
||||
ls
|
||||
lsattr
|
||||
lsblk
|
||||
lsmod
|
||||
lsof
|
||||
lspci
|
||||
make
|
||||
mount
|
||||
mtr
|
||||
mvn
|
||||
netstat
|
||||
nmap
|
||||
ntpdate
|
||||
php
|
||||
ping
|
||||
ping6
|
||||
proftpd
|
||||
ps
|
||||
sar
|
||||
semanage
|
||||
sensors
|
||||
showmount
|
||||
sockstat
|
||||
ss
|
||||
stat
|
||||
sysctl
|
||||
systemctl
|
||||
tcpdump
|
||||
traceroute
|
||||
traceroute6
|
||||
tune2fs
|
||||
ulimit
|
||||
uptime
|
||||
vmstat
|
||||
wdiff
|
||||
whois
|
||||
)
|
||||
|
||||
# Set alias for available commands.
|
||||
for cmd in $cmds ; do
|
||||
if (( $+commands[$cmd] )) ; then
|
||||
$cmd() {
|
||||
grc --colour=auto ${commands[$0]} "$@"
|
||||
}
|
||||
fi
|
||||
done
|
||||
|
||||
# Clean up variables
|
||||
unset cmds cmd
|
1
k
Submodule
1
k
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit e2bfbaf3b8ca92d6ffc4280211805ce4b8a8c19e
|
1
pure
Submodule
1
pure
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 5b458ba5b75f49a8071d53c343f1a23631f7bced
|
44
stats.sh
Executable file
44
stats.sh
Executable file
@ -0,0 +1,44 @@
|
||||
#!/usr/bin/env zsh
|
||||
|
||||
l="$(tput setaf 245)" # left
|
||||
h="$(tput setaf 10)" # highlight
|
||||
n="$(tput setaf 28)" # normal
|
||||
|
||||
ip=$(hostname -I 2>/dev/null | awk '{print $1}')
|
||||
[ -z $ip ] && ip="$(curl -4s ifconfig.me)"
|
||||
#sessions=$(who | awk '{print $5}' | wc -l)" session"
|
||||
sessions=$(echo $(who | awk '{print $5}' | wc -l))" session"
|
||||
[ $sessions != "1 session" ] && sessions+=s
|
||||
uptime=$(($(cat /proc/uptime | cut -d'.' -f1)/86400))" day"
|
||||
[ $uptime != "1 day" ] && uptime+=s
|
||||
load=$(awk '{print $1, $2, $3}' /proc/loadavg)
|
||||
#ram_free=$(free -m | grep "m:" | awk '{print $7}')
|
||||
ram_free=$(free -m | grep "m:" | awk '{print $4}')
|
||||
swp_used=$(free -m | grep "p:" | awk '{print $3}')
|
||||
space1=$(df -h / | grep dev | awk '{print $4}')
|
||||
#space2=$(df -h /srv | grep dev | awk '{print $4}')
|
||||
|
||||
echo
|
||||
echo " ${l}Host: ${h}$(hostname) @ $ip ${n}(${h}$sessions ${n}open)"
|
||||
echo " ${l}Load: ${h}$load${n}, ${h}$uptime ${n}up"
|
||||
echo " ${l}Memory: ${h}${ram_free}M ${n}free, ${h}${swp_used}M ${n}swapped"
|
||||
echo " ${l}Space: ${h}/ ${h}$space1 ${n}free"
|
||||
#echo " ${l}Space: ${h}/ ${h}$space1 ${n}free, ${h}/srv $space2 ${n}free"
|
||||
|
||||
|
||||
if command -v vnstat &> /dev/null; then
|
||||
traffic_day=$(vnstat --oneline | awk -F';' '{print $6}')
|
||||
traffic_month=$(vnstat --oneline | awk -F';' '{print $11}')
|
||||
echo " ${l}Traffic: ${h}$traffic_day ${n}today, ${h}$traffic_month ${n}this month"
|
||||
fi
|
||||
|
||||
#echo
|
||||
|
||||
#warn=" $(tput blink; tput setaf 196)!$(tput sgr0)"
|
||||
#fortune -os | cowsay -f `find /usr/share/cowsay/cows -type f -size -400c | shuf -n 1` | lolcat -f -S 50 -p 10 | sed 's/^/ /'
|
||||
#fortune -asn 300 | cowsay -nf small | lolcat -f -S 50 -p 10 | sed 's/^/ /'
|
||||
|
||||
echo "$(tput setaf 245)"
|
||||
#fortune -asn 300 | cowsay -nf small | sed 's/^/ /'
|
||||
fortune -as | cowsay -nf small | sed 's/^/ /'
|
||||
echo "$(tput sgr0)"
|
1
zsh-autosuggestions
Submodule
1
zsh-autosuggestions
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a411ef3e0992d4839f0732ebeb9823024afaaaa8
|
1
zsh-syntax-highlighting
Submodule
1
zsh-syntax-highlighting
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit c5ce0014677a0f69a10b676b6038ad127f40c6b1
|
90
zshrc
Normal file
90
zshrc
Normal file
@ -0,0 +1,90 @@
|
||||
export ZSHDIR=$HOME/.config/zsh
|
||||
export PATH=$HOME/bin:$PATH
|
||||
export FPATH=$FPATH:$ZSHDIR/pure
|
||||
export HISTFILE=$HOME/.zsh_history
|
||||
export OS="$(uname -s)"
|
||||
#export TERM=xterm-256color
|
||||
export EDITOR=nano
|
||||
export HISTSIZE=1000000
|
||||
export SAVEHIST=1000000
|
||||
export HISTORY_IGNORE="(l *|la *|ls *|cd|cd *|rm *|echo *|find *|cat *|ccat *|apt*|mkdir *|rmdir *|rsync *|git *|nano *|screen *|traceroute *|ping *|whois *|md5sum *|timeout *|tmux *|mount *|openssl *|watch *|dpkg *|chown *|mv *|cp *|grc *|scp *|tail *|wget *|zcat *|time *|curl *|while *|unp *|attr *|dialog *|sysbench *|ftp *|truncate *|ln *|grep *|chmod *|*grep*|man *|pidof *|nslookup *|umount *|sleep *|pushd *| popd *|kill *|su *|tar *|touch *|7z *|hexdump *|du|du *|ack *|\\\\*)"
|
||||
setopt hist_reduce_blanks hist_ignore_space hist_ignore_all_dups interactive_comments share_history
|
||||
|
||||
alias ..="cd .."
|
||||
alias ff="find . -type f -iname"
|
||||
alias fd="find . -type d -iname"
|
||||
alias nolog="unset HISTFILE"
|
||||
alias grep="grep --color=auto"
|
||||
alias cdu="cdu.pl -sridh"
|
||||
alias l="k -h --no-vcs --group-directories-first"
|
||||
alias la="k -h -A --no-vcs --group-directories-first"
|
||||
alias bell='echo -en "\007"'
|
||||
if [ "$OS" = "Linux" ]; then
|
||||
alias rm="rm -I"
|
||||
alias update="sudo apt-get update && sudo apt-get upgrade; sudo apt-get clean"
|
||||
elif [ "$OS" = "Darwin" ]; then
|
||||
alias update="brew update && brew upgrade"
|
||||
fi
|
||||
|
||||
function cheat { curl cheat.sh/$1 }
|
||||
function mcd { mkdir -p $1; cd $1 }
|
||||
function pw { echo `tr -dc ACDEFHJKLMNPRTUVWX </dev/urandom | head -c1``pwgen -AnBs 23 1` | fold -w4 | paste -sd'-' - }
|
||||
function precmd { print -Pn "\e]2;%m (%~)\a\e]1;%m\a"; }
|
||||
function _force_rehash { (( CURRENT==1 )) && rehash; return 1 }
|
||||
|
||||
bindkey -e
|
||||
bindkey '^R' history-incremental-search-backward
|
||||
bindkey '^[[5~' up-line-or-history
|
||||
bindkey '^[[6~' down-line-or-history
|
||||
bindkey '^[[A' up-line-or-search
|
||||
bindkey '^[[B' down-line-or-search
|
||||
bindkey '^[[H' beginning-of-line
|
||||
bindkey '^[[1~' beginning-of-line
|
||||
bindkey '^[[F' end-of-line
|
||||
bindkey '^[[4~' end-of-line
|
||||
bindkey '^[[Z' reverse-menu-complete
|
||||
bindkey '^[[3~' delete-char
|
||||
bindkey '^[3;5~' delete-char
|
||||
bindkey '^[m' copy-prev-shell-word
|
||||
bindkey '^[k' history-beginning-search-backward
|
||||
bindkey '^[j' history-beginning-search-forward
|
||||
bindkey '^[^I' _history-complete-older
|
||||
bindkey '^[^[^I' _history-complete-newer
|
||||
bindkey '^U' backward-kill-line
|
||||
bindkey "^[[1;5C" forward-word
|
||||
bindkey "^[[1;5D" backward-word
|
||||
bindkey "^[[1;5A" beginning-of-line
|
||||
bindkey "^[[1;5B" end-of-line
|
||||
|
||||
autoload -Uz promptinit && promptinit && prompt pure
|
||||
autoload -Uz compinit && compinit && zmodload -i zsh/complist
|
||||
|
||||
# ...*:corrections' format $'%{\e[0;31m%}%d (errors: %e)%{\e[0m%}' #
|
||||
#zstyle ':completion:::::' completer _force_rehash _complete _approximate
|
||||
zstyle ':completion:::::' completer _expand _complete _prefix _ignored _approximate
|
||||
zstyle -e ':completion:*:approximate:*' max-errors 'reply=( $(( ($#PREFIX + $#SUFFIX) / 3 )) )'
|
||||
zstyle ':completion:*:corrections' format "- %d - (errors %e})"
|
||||
zstyle ':completion:*' menu select
|
||||
zstyle ':completion:*' group-name ''
|
||||
zstyle ':completion:*:descriptions' format ' %F{yellow}-- %d --%f'
|
||||
zstyle ':completion:*:warnings' format " ${c160}-- no matches found --%f"
|
||||
zstyle ':completion:*:hosts' hosts ${${${${(@M)${(f)"$(<~/.ssh/config)"}:#Host *}#Host }:#*\**}:#*\?*}
|
||||
zstyle ':completion:*:users' ignored-patterns '_*' 'Guest' 'daemon' 'nobody'
|
||||
zstyle ':completion:*:(scp|rsync):*' group-order hosts users files all-files
|
||||
#zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami` -o pid,user,comm -w -w"
|
||||
zstyle ':completion:*:*:*:*:processes' command "ps -u `whoami`"
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;34=0=01'
|
||||
zstyle ':completion:*:*:kill:*' menu yes select
|
||||
zstyle ':completion:*:*:kill:*' force-list always
|
||||
zstyle ':completion:*:*:kill:*' insert-ids single
|
||||
zstyle ':completion:*:manuals' separate-sections true
|
||||
zstyle ':completion:*:manuals.(^1*)' insert-sections true
|
||||
zstyle ':prompt:pure:prompt:success' color cyan
|
||||
|
||||
source $ZSHDIR/grc.zsh
|
||||
source $ZSHDIR/k/k.plugin.zsh
|
||||
source $ZSHDIR/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
source $ZSHDIR/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
|
||||
if [[ -d "$HOME/bin/ImageMagick-7.0.1" ]]; then export MAGICK_HOME="$HOME/bin/ImageMagick-7.0.10"; export PATH="$PATH:$MAGICK_HOME/bin"; export DYLD_LIBRARY_PATH="$MAGICK_HOME/lib/"; fi
|
||||
# $ZSHDIR/stats.sh
|
Loading…
x
Reference in New Issue
Block a user