]> git.armaanb.net Git - dotfiles.git/blob - .kshrc
nvim: switch to init.lua
[dotfiles.git] / .kshrc
1 [ $(hostname) = "alcatraz.armaanb.net" ] && {
2         date
3         apm | head -n 1
4 }
5
6 set -o vi
7
8 alias pman='man -M /usr/local/share/doc/posix/man'
9 alias papropos='apropos -M /usr/local/share/doc/posix/man'
10 alias pwhatis='whatis -M /usr/local/share/doc/posix/man'
11
12 alias rsync='openrsync -rv'
13
14 ufile() {
15     [ "$(file -bi "$1")" = "text/plain" ] && ext="txt"
16     ext=$(printf "%s" "$1" | awk -F . '{print $NF}')
17     fname="$(basename ${2:-tmp$RANDOM.$ext})"
18     rsync "$1" "l.armaanb.net:/var/www/htdocs/l.armaanb.net/$fname"
19     printf "https://l.armaanb.net/%s\n" "$fname" | xclip && \
20         xclip -o
21 }
22
23 export GPG_TTY="$(tty)"
24 export CDPATH=":~"
25
26 alias ls="LC_COLLATE=C ls -lhF"
27 alias df="df -h"
28 alias du="du -h"
29 alias cp="cp -riv"
30 alias rm='rm -iv'
31 alias mv='mv -iv'
32 alias ln='ln -v'
33 alias grep='grep -in'
34 alias mkdir='mkdir -p'
35 alias nl='nl -b all'
36 alias rclone='rclone -P'
37
38 alias ytmusic="youtube-dl --add-metadata --extract-audio \
39         --audio-format vorbis --prefer-ffmpeg --restrict-filenames \
40         -o '%(title)s.%(ext)s'"
41 alias mosh="env LC_CTYPE=en_US.UTF-8 mosh"
42 alias serve="python3 -m http.server"
43 alias wttr='curl wttr.in?format="%l+%T\n%C+%t\nSunrise:+%S,+Sunset+%s\n"'
44 alias nv="nvim"
45 alias dotgit="git --git-dir=~/.local/share/dotfiles --work-tree=~"
46
47 pass() {
48         printf "Master password: "
49         stty -echo
50         read masterpass
51         stty echo
52         sqlcipher .passwords.db -column -cmd "PRAGMA key = \"$masterpass\"" "$1"
53 }
54
55 plike() {
56         pass "SELECT * FROM p WHERE name LIKE \"%$1%\";"
57 }
58
59 pget() {
60         pass "SELECT * FROM p WHERE name = \"$1\";"
61 }
62
63 pinsert() {
64         printf "New password: "
65         stty -echo
66         read newpass
67         stty echo
68         pass "INSERT INTO p VALUES (\"$1\", \"$2\", \"$newpass\");"
69 }
70
71 pgen() {
72         tr -dc 'A-Za-z0-9!"#$%&'\''()*+,-./:;<=>?@[\]^_`{|}~' < /dev/urandom \
73                 | fold -w 20 \
74                 | head -n 1
75 }
76
77
78 dosa() {
79         echo "Dosa! Yum yum yum"
80         doas $@
81 }
82
83 watch() {
84         inp=$1
85         shift
86         fwa $inp | while read; do $@; done
87 }
88
89 stty dsusp undef