annotate .bashrc @ 148:f0bee28995f1

do the work for cdx2sql
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Mon, 25 Oct 2021 15:05:46 +0000
parents 53006db54871
children 2b59f3ef2294
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
1 # .bashrc
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
2
112
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 83
diff changeset
3 export G=${HOME}/gentoo
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
4 # Uncomment the following line if you don't like systemctl's auto-paging feature:
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
5 # export SYSTEMD_PAGER=
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
6
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
7 if [ $SHELL = "/bin/bash" ]
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
8 then
112
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 83
diff changeset
9 # Vanilla Cirrus login
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
10 # Source global definitions
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
11 if [ -f /etc/bashrc ]; then
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
12 . /etc/bashrc
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
13 fi
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
14
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
15 if [ "$PS1" ]; then
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
16 PS1='\[\033[1m\]\h\[\033[0m\]<\!>: '
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
17 echo "Vanilla bashrc" 1>&2
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
18 # don't put duplicate lines or lines starting with space in the history.
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
19 # See bash(1) for more options
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
20 # export HISTCONTROL=ignoreboth [readonly on Cirrus :-[
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
21
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
22 # append to the history file, don't overwrite it
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
23 shopt -s histappend
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
24
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
25 # for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
26 # export HISTSIZE=3000 [readonly on Cirrus :-[
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
27 export HISTFILESIZE=6000
122
9de06ae73372 workaround histcontrol
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 112
diff changeset
28 export HISTIGNORE='[ ]*:&:[fb]g:exit'
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
29 fi
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
30
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
31 module load gcc # assumed by Prefix
112
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 83
diff changeset
32 module load gnu-parallel
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
33
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
34 export PYTHONPATH=$HOME/lib/python3.6/site-packages
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
35
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
36 PATH="/lustre/home/dc007/hst/lib/perl5/bin${PATH:+:${PATH}}"; export PATH;
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
37 PERL5LIB="/lustre/home/dc007/hst/lib/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
38 PERL_LOCAL_LIB_ROOT="/lustre/home/dc007/hst/lib/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
39 PERL_MB_OPT="--install_base \"/lustre/home/dc007/hst/lib/perl5\""; export PERL_MB_OPT;
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
40 PERL_MM_OPT="INSTALL_BASE=/lustre/home/dc007/hst/lib/perl5"; export PERL_MM_OPT;
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
41
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
42 export ANT_HOME=$HOME/src/apache-ant-1.10.7
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
43 export MAVEN_HOME=$HOME/src/apache-maven-3.6.3
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
44 export JAVA_HOME=$HOME/lib/openjdk-8u252-b09
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
45 export PATH=${PATH}:${ANT_HOME}/bin:${MAVEN_HOME}/bin
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
46
112
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 83
diff changeset
47 EDITOR=emacs
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
48 else
112
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 83
diff changeset
49 # gentoo
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
50 if [ "$PS1" ]; then
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
51 echo "~/.bashrc inside gentoo" 1>&2
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
52 PS1='\[\e[1;32m\]\h\[\e[0m\]<\!>: '
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
53 # Source some global definitions?
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
54
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
55 # These are readonly under Cirrus, so repeated here where they work1
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
56 export HISTCONTROL=ignoreboth
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
57 export HISTSIZE=3000
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
58 export HISTFILESIZE=6000
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
59 shopt -s histappend
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
60
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
61 if [ "$DISPLAY" ]
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
62 then
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
63 xrdb $HOME/.Xresources
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
64 fi
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
65 fi
112
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 83
diff changeset
66 EDITOR=xemacs
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
67 fi
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
68
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
69 # User specific aliases and functions
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
70 #module add gnu-parallel
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
71 #export N1=rli4n35
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
72 #export N2=rli6n35
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
73 #export NN="$N1 $N2"
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
74
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
75 # Tools
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
76 function lss() {
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
77 /bin/ls -l "$@" | sort -nr -k 5,5
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
78 }
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
79
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
80 function sus() {
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
81 sort "$@" | uniq -c | sort -k1nr,1
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
82 }
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
83
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
84 function tot ()
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
85 {
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
86 awk '{sum+=$1} END {printf "%u\n",sum}'
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
87 }
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
88
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
89 btot ()
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
90 {
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
91 python3 -c 'import sys
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
92 n=0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
93 for l in sys.stdin:
126
53006db54871 better btot
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 122
diff changeset
94 try:
53006db54871 better btot
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 122
diff changeset
95 n+=int(l)
53006db54871 better btot
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 122
diff changeset
96 except ValueError as e:
53006db54871 better btot
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 122
diff changeset
97 print(e,file=sys.stderr)
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
98 print(n)
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
99 '
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
100 }
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
101
112
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 83
diff changeset
102 function uz () { $G/usr/bin/igzip -dc "$@" ; }
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
103
0
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
104 function typecat ()
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
105 {
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
106 tt=$(type $1)
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
107 case $tt in
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
108 *\ is\ hashed\ *) cat $(echo $tt | cut -f 4 -d ' ' | tr -d '()') ;;
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
109 *\ is\ /*) cat $(echo $tt | cut -f 3 -d ' ' | tr -d '()') ;;
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
110 *) type $1 ;;
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
111 esac
65a56c0d1c1f bolting the barn door...
Henry S. Thompson <ht@inf.ed.ac.uk>
parents:
diff changeset
112 }
83
8fb11e337e23 environment improvements
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 61
diff changeset
113 #export HISTSIZE=3000
61
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 20
diff changeset
114
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 20
diff changeset
115 PATH=$PATH:$HOME/.local/bin:$HOME/bin
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 20
diff changeset
116
112
Henry S. Thompson <ht@inf.ed.ac.uk>
parents: 83
diff changeset
117 export PATH EDITOR PS1 G