1alias ls='ls --color=auto'2alias l='ls'3alias ll='ls -lh'456[ -x "$(command -v helix)" ] && alias hx='helix'78alias tt='tmux new -A -s'910alias task='go-task'1112alias de='doasedit'1314alias rs='rsync -rz --info=progress2'15alias rrs='RSYNC_PASSWORD=$(pass tool/rsyncd/lindsay) rsync-ssl -rz --info=progress2'1617alias ppgrep='ps aux | grep -v grep | grep $@'1819[ -x "$(command -v edit)" ] && alias e=edit2021alias ossh='ssh -o "SetEnv TMUX=off"'22if [[ -x "$(command -v fzf)" && -x "$(command -v sshhosts)" ]]; then23 alias sshgrep='ssh ${$(sshhosts -s |fzf --height=~50| awk '"'"'{print $1}'"'"'):--V}'24fi2526###############################27# generate random password28function _passgen() {29 local chars numbers lowers uppers30 chars='!@?%^_=*#&'31 numbers='0123456789'32 lowers='abcdefghijklmnopqrstuvwxyz'33 uppers='ABCDEFGHIJKLMNOPQRSTUVWXYZ'34 length=$13536 { </dev/urandom LC_ALL=C grep -ao '[A-Za-z0-9!@?%^_=*#&]' \37 | head -n$((length-4))38 echo ${chars:$((RANDOM % ${#chars})):1} # Random special char.39 echo ${numbers:$((RANDOM % ${#numbers})):1}40 echo ${lowers:$((RANDOM % ${#lowers})):1}41 echo ${uppers:$((RANDOM % ${#uppers})):1}42 } | shuf | tr -d '\n'43}4445function passgen() {46 local o_copy o_help47 local usage=(48 "$0 [-h|--help]"49 "$0 [-c|--copy] [length]"50 )5152 zmodload zsh/zutil53 zparseopts -D -F -K -- \54 {h,-help}=o_help \55 {c,-copy}=o_copy || return 15657 [[ -z "$o_help" ]] || { print -l $usage && return }5859 _pass=`_passgen ${1:=$((RANDOM %8 + 10))}`60 [[ -z "$o_copy" ]] || { echo $_pass | wl-copy -n }6162 echo $_pass63}64###############################65# SSH66alias ssh-mount='sshfs -o uid=$(id -u) -o gid=$(id -g) -o allow_root -o remember=20 -o sync_readdir -o sshfs_sync -o reconnect $@'6768###############################69# pastebin clients70function cpb () {71 wl-paste | pb $@72}73function pbd() {74 curl -XDELETE ${KPASTE_HOST:-"https://pb.koi.moe"}/$175}7677function ix() {78 local opts79 local OPTIND80 [ -f "$HOME/.netrc" ] && opts='-n'81 while getopts ":hd:i:n:" x; do82 case $x in83 h) echo "ix [-d ID] [-i ID] [-n N] [opts]"; return;;84 d) $echo curl $opts -X DELETE ix.io/$OPTARG; return;;85 i) opts="$opts -X PUT"; local id="$OPTARG";;86 n) opts="$opts -F read:1=$OPTARG";;87 esac88 done89 shift $(($OPTIND - 1))90 [ -t 0 ] && {91 local filename="$1"92 shift93 [ "$filename" ] && {94 curl $opts -F f:1=@"$filename" $* ix.io/$id95 return96 }97 echo "^C to cancel, ^D to send."98 }99 curl $opts -F f:1='<-' $* ix.io/$id100}101102function farsee() {103 local file=${1:-/dev/stdin}104 curl -F "c=@${file}" "https://fars.ee/"105}106107###############################108# Weather109function wt() {110 local city=${1:-"Wuhan"}111 curl -s "wttr.in/$city?T"112}