Update. master
authorFrançois Fleuret <francois@fleuret.org>
Mon, 21 Nov 2022 07:21:54 +0000 (08:21 +0100)
committerFrançois Fleuret <francois@fleuret.org>
Mon, 21 Nov 2022 07:21:54 +0000 (08:21 +0100)
arxiv.sh
kill-unused-xterms.sh

index 1cc408a..556b403 100755 (executable)
--- a/arxiv.sh
+++ b/arxiv.sh
@@ -29,10 +29,11 @@ tmp=$(mktemp /tmp/arxiv-bib.sh.XXXXXX)
 while [[ "$1" ]]
 do
 
-    if [[ $1 =~ ^http ]] || [[ $1 =~ ^[0-9\.]*$ ]]
+    if [[ $1 =~ ^http ]] || [[ $1 =~ ^[0-9v\.]*$ ]]
     then
-        id="$(echo "$1" | sed -e 's|^.*/\([0-9.]*\)$|\1|')"
-        wget "https://arxiv.org/pdf/${id}"
+        id="$(echo "$1" | sed -e 's|^.*/\([0-9v.]*\)$|\1|' | sed -e 's/v[0-9]*$//')"
+        wget -U "Mozilla/5.0 (iPhone; CPU iPhone OS 11_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.0 Mobile/15E148 Safari/604.1" "https://arxiv.org/pdf/${id}"
+        mv "${id}" "${id}.pdf"
         filename="${id}.pdf"
     else
         filename="$1"
@@ -112,7 +113,8 @@ EOF
         AUTHORS="${FIRST_AUTHOR} et al"
     fi
 
-    TITLE="$(echo "${AUTHORS} - ${TITLE} ${YEAR} ${id}.pdf" | sed -e 's/ /_/g')"
+    #TITLE="$(echo "${AUTHORS} - ${TITLE} ${YEAR} ${id}.pdf" | sed -e 's/ /_/g')"
+    TITLE="$(echo "${AUTHORS} - ${TITLE} ${YEAR} ${id}.pdf" | sed -e 's/[^-a-zA-Z0-9_\.\/]/_/g' | sed -e 's/__*/_/g')"
 
     mv -v "${filename}" "${ARXIV_BIBDIR}/${TITLE}"
 
@@ -122,4 +124,4 @@ EOF
 
 done
 
-rm -rf ${tmp}
+#rm -rf ${tmp}
index 075b2ba..8100b6b 100755 (executable)
 
 set -e
 
+TERMINAL_APP=xterm
+[[ "${TERMINAL_APP}" ]] || TERMINAL_APP=xterm
+
 NB_KILLED=0
 NB_TOTAL=0
 SHELL_NAME=$(basename ${SHELL})
 
 # Loop through the pid of xterms
-for ppid in $(ps h -C xterm -o pid); do
+for ppid in $(ps h -C "${TERMINAL_APP}" -o pid); do
 
     N=0