X-Git-Url: https://git.armaanb.net/?p=dotfiles.git;a=blobdiff_plain;f=.kshrc;h=8d6892c7c6cc2345a56527307a1cff135355e016;hp=d272cd6b29768c82e59b6be6202d017416781a13;hb=HEAD;hpb=1f5e5ed306e2cd24d9d6a4d5570024eaa279d47e diff --git a/.kshrc b/.kshrc index d272cd6..8d6892c 100644 --- a/.kshrc +++ b/.kshrc @@ -1,29 +1,78 @@ +[ $(hostname) = "alcatraz.armaanb.net" ] && { + date + apm | head -n 1 +} + set -o vi -ulimit -c unlimited -alias rsync="openrsync -rv" -export CDPATH=:~ + +alias pman='man -M /usr/local/share/doc/posix/man' +alias papropos='apropos -M /usr/local/share/doc/posix/man' +alias pwhatis='whatis -M /usr/local/share/doc/posix/man' + +alias rsync='openrsync -rv' + +ufile() { + [ "$(file -bi "$1")" = "text/plain" ] && ext="txt" + ext=$(printf "%s" "$1" | awk -F . '{print $NF}') + fname="$(basename ${2:-tmp$RANDOM.$ext})" + rsync "$1" "l.armaanb.net:/var/www/htdocs/l.armaanb.net/$fname" + printf "https://l.armaanb.net/%s\n" "$fname" | xsel -sel c +} + +export GPG_TTY="$(tty)" +export CDPATH=":~" + alias ls="LC_COLLATE=C ls -lhF" -alias rm="rm -iv" +alias df="df -h" +alias du="du -h" alias cp="cp -riv" -alias mv="mv -iv" -alias grep="grep -in" -alias nl="nl -b all" -alias rclone="rclone -P" +alias rm='rm -iv' +alias mv='mv -iv' +alias grep='grep -in' +alias mkdir='mkdir -p' +alias nl='nl -b all' +alias rclone='rclone -P' + +alias ytmusic="youtube-dl --add-metadata --extract-audio \ + --audio-format vorbis --prefer-ffmpeg --restrict-filenames \ + -o '%(title)s.%(ext)s'" alias mosh="env LC_CTYPE=en_US.UTF-8 mosh" -alias ytmusic="youtube-dl --add-metadata --extract-audio --audio-format vorbis --restrict-filenames -o '%(title)s.%(ext)s'" +alias serve="python3 -m http.server" +alias wttr='curl wttr.in?format="%l+%T\n%C+%t\nSunrise:+%S,+Sunset+%s\n"' +alias nv="nvim" +alias dotgit="git --git-dir=~/.local/share/dotfiles --work-tree=~" -stty dsusp undef +pass() { + printf "Master password: " + stty -echo + read masterpass + stty echo + sqlcipher .passwords.db -column -cmd "PRAGMA key = \"$masterpass\"" "$1" +} + +plike() { + pass "SELECT * FROM p WHERE name LIKE \"%$1%\";" +} + +pget() { + pass "SELECT * FROM p WHERE name = \"$1\";" +} -alias mspdf="groff -Tpdf -M ~/var/docs -ms -macheam" +pinsert() { + printf "New password: " + stty -echo + read newpass + stty echo + pass "INSERT INTO p VALUES (\"$1\", \"$2\", \"$newpass\");" +} -rpdf() { - tmp=/tmp/rpdf${RANDOM}.pdf - mspdf $1 > $tmp - zathura $tmp & - fwa $1 | while read; do mspdf $1 > $tmp; done - rm -f $tmp +pgen() { + tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' < /dev/urandom \ + | fold -w 20 \ + | head -n 1 } + dosa() { echo "Dosa! Yum yum yum" doas $@ @@ -35,6 +84,4 @@ watch() { fwa $inp | while read; do $@; done } -alias wttr='curl wttr.in?format="%l+%T\n%C+%t\nSunrise:+%S,+Sunset+%s\n"' -alias nv="nvim" -alias dotgit="git --git-dir=~/.local/share/dotfiles --work-tree=~" +stty dsusp undef