globalshellrc - randomcrap - random crap programs of varying quality
 (HTM) git clone git://git.codemadness.org/randomcrap
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
       globalshellrc (3252B)
       ---
            1 export ENV="$HOME/.kshrc"
            2 
            3 export PATH="$HOME/bin:$HOME/.config/scripts:$PATH"
            4 
            5 # UTF-8 en-US.
            6 export LC_ALL="en_US.UTF-8"
            7 
            8 export PS1="\w \\$ "
            9 
           10 export EDITOR="mg"
           11 export BROWSER="firefox"
           12 export PAGER="less -i"
           13 
           14 # OpenBSD:
           15 # better/old truetype font hinting https://www.freetype.org/freetype2/docs/subpixel-hinting.html
           16 # https://pandasauce.org/post/linux-fonts/
           17 #export FREETYPE_PROPERTIES="truetype:interpreter-version=35 cff:no-stem-darkening=1 autofitter:warping=1"
           18 
           19 # linux (uncomment):
           20 #export FREETYPE_PROPERTIES="truetype:interpreter-version=38"
           21 
           22 # insensitive search
           23 alias less="less -i"
           24 alias e="$EDITOR"
           25 #alias s='doas -s'
           26 alias l='ls -alF'
           27 alias gb='git branch'
           28 alias gc='git checkout'
           29 alias gd='git diff'
           30 alias gl='git log --stat'
           31 alias gp='git pull'
           32 alias gr='git remote'
           33 alias gs='git status'
           34 # OpenBSD dev preferences for git patches.
           35 alias ogdiff='git diff --no-prefix'
           36 alias img='sxiv'
           37 
           38 # don't allow messages to tty (wall, talk etc, except for root ofcourse).
           39 mesg n
           40 
           41 # ctrl-t status (SIGINFO), useful for example for dd(1) progress .
           42 # OpenBSD (comment on Linux):
           43 #stty status ^T
           44 
           45 # disable Software Control Flow (on ctrl-s).
           46 stty -ixon
           47 
           48 # hexdump
           49 hd() {
           50         hexdump -e '"%08.8_ax  " 8/1 "%02X " " - " 8/1 "%02X "' \
           51                 -e '"  |" "%_p"' -e '"|\n"' "$@"
           52 }
           53 
           54 base64encode() {
           55         uuencode -m - | sed '1d;$ d'
           56 }
           57 
           58 base64decode() {
           59         (echo "begin-base64 644 -";cat;echo "====") | uudecode -m -o /dev/stdout
           60 }
           61 
           62 screenshot() {
           63         t="$(mktemp).png"
           64         xscreenshot | ff2pngrgb8 > "$t"
           65         optipng "$t"
           66         cat "$t"
           67         rm -f "$t"
           68 }
           69 
           70 cowpaste() {
           71         ssh hiltjo@cow "cat > /home/www/gopher/paste/$1"
           72 
           73         echo "HTTP:          https://codemadness.org/paste/$1"
           74         echo "Gopher binary: gophers://codemadness.org/9/paste/$1"
           75         echo "Gopher image:  gophers://codemadness.org/I/paste/$1"
           76         echo "Gopher text:   gophers://codemadness.org/0/paste/$1"
           77 }
           78 
           79 # global grep in all words for man pages.
           80 sman() {
           81         grep -RHniE $1 /usr/share/man/ /usr/X11R6/man/ /usr/local/share/man/
           82 }
           83 
           84 # C-l should clear the screen
           85 # TODO: remove clear bind later, it is added by default on ksh now:
           86 bind -m '^L'='^U'clear'^J''^Y'
           87 # C-w should delete word backward.
           88 bind '^W'='delete-word-backward'
           89 
           90 bind '^[[4~'='end-of-line'
           91 bind '^[[1~'='beginning-of-line'
           92 bind '^[[3~'='delete-char-forward'
           93 bind '^[[P'=delete-char-forward
           94 
           95 sfeedcurses() {
           96         PAGER="less -Ri +g" \
           97         SFEED_HTMLCONV="webdump -d -8 -r -i -l -a" \
           98         SFEED_AUTOCMD="${SFEED_AUTOCMD:-tgo}" \
           99         SFEED_LAZYLOAD="${SFEED_LAZYLOAD:-1}" \
          100         SFEED_PLUMBER="${SFEED_PLUMBER:-/home/hiltjo/.config/scripts/plumb_setsid.sh}" \
          101                 sfeed_curses "$@"
          102 }
          103 
          104 sc() {
          105         SFEED_URL_FILE="${SFEED_URL_FILE:-$HOME/.sfeed/urls}" sfeedcurses ~/.sfeed/thisweek/*
          106 }
          107 
          108 # show new today (no url file).
          109 sct() {
          110         unset SFEED_URL_FILE
          111         sfeedcurses ~/.sfeed/thisweek/*
          112 }
          113 
          114 # all feeds
          115 sca() {
          116         SFEED_URL_FILE="$HOME/.sfeed/urls" sfeedcurses ~/.sfeed/feeds/*
          117 }
          118 
          119 syncnews() {
          120         "$HOME/.sfeed/syncnews.sh"
          121 }
          122 
          123 markallread() {
          124         "$HOME/.sfeed/markallread.sh"
          125 }
          126 
          127 # update remotely and sync.
          128 updatenews() {
          129         ssh cow '~/.sfeed/updateall.sh'
          130         syncnews
          131 }
          132 
          133 news() {
          134         syncnews
          135         sc
          136 }
          137 
          138 youtube() {
          139         t=$(mktemp)
          140         f="${t}.mp4"
          141         youtube-dl -o "$f" "$1"
          142         mpv "$f"
          143         #rm -f "$f"
          144 #        ~/.config/scripts/youtube.sh "$1"
          145 }
          146 
          147 date() {
          148         # force POSIX locale output date (for Linux).
          149         LC_ALL="C" /bin/date "$@"
          150 }