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