changeset 74:432915a28952

merge
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Tue, 08 Aug 2023 17:48:29 +0100
parents e8c667bf8965 (diff) e8f89aaa07c1 (current diff)
children 177f7df2bf46
files
diffstat 3 files changed, 48 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/.bash_profile	Fri Jul 28 00:50:13 2023 +0100
+++ b/.bash_profile	Tue Aug 08 17:48:29 2023 +0100
@@ -7,3 +7,4 @@
 
 # User specific environment and startup programs
 
+unset MANPATH
--- a/.bashrc	Fri Jul 28 00:50:13 2023 +0100
+++ b/.bashrc	Tue Aug 08 17:48:29 2023 +0100
@@ -20,6 +20,8 @@
     echo -ne '\033]0;'${HOSTNAME/-login/} ${PWD/$HOME/w\~}'\007'
 }
 
+PATH=$PATH:$HOME/.local/bin:$HOME/bin
+
 if [ "$PS1" ]; then
   echo "Singularity bash" 1>&2
   # don't put duplicate lines or lines starting with space in the history.
@@ -33,6 +35,21 @@
   export HISTSIZE=3000
   export HISTFILESIZE=6000
   export HISTIGNORE='[ ]*:&:[fb]g:exit'
+
+ # fix $W -> \$W after tab completion
+ shopt -u progcomp
+
+ if [ -d /mnt/lustre/indy2lfs/sw/ ]
+ then
+  # We have access to mounted modules from Cirrus, use anaconda python libs,
+  #  in particular, tkinter for matplotlib
+  export MODULES=/mnt/lustre/indy2lfs/sw
+  export SING=csing
+  export PYTHONPATH=:/usr/lib/python39.zip:/usr/lib/python3.9:/usr/lib/python3.9/lib-dynload:/usr/local/lib/python3.9/dist-packages:/usr/lib/python3/dist-packages
+  PATH=$MODULES/anaconda/anaconda3-2021.11/bin:$PATH
+  export XDG_RUNTIME_DIR=/tmp/runtime-$USER
+ fi
+ 
 fi
 
 EDITOR=xemacs
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/sort_date.py	Tue Aug 08 17:48:29 2023 +0100
@@ -0,0 +1,30 @@
+#!/usr/bin/python3
+# Assumes you have used grep -v $'\t' on input for speed
+# Recommended to also sed '/GMT$/s/\([^ ]\)GMT$/\1 GMT/'
+#  to fix a common 'bad' timestamp (~ .2% of inputs)
+import email.utils
+import sys
+from urllib.parse import urlsplit
+
+def keyed(l):
+  uri, dateTime = l.split('\t',1)
+  try:
+    epoch = email.utils.parsedate_to_datetime(dateTime).timestamp()
+    parts = urlsplit(uri)
+    nl = parts.netloc
+    if ':' in nl:
+      pa,pp=nl.split(':')
+      (kk:=pa.split('.')).reverse()
+      return ('%s:%s)%s'%(','.join(kk), pp, parts.path),epoch)
+    else:
+      (kk:=nl.split('.')).reverse()
+      return ('%s)%s'%(','.join(kk), parts.path),epoch)
+  except Exception as e:
+    print(dateTime.rstrip(),e,sep='\t',file=sys.stderr)
+    return
+
+with open(sys.argv[1],"r") as ff:
+  for tl in sorted((kk for l in ff if (kk:=keyed(l)) is not None),
+                   key=lambda x:x[0]):
+    print(tl[0],tl[1],sep='\t')
+