From 71b861a1c642e2f955ef58b152354824d7d58404 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Tue, 2 Jun 2015 09:35:47 +0200 Subject: [PATCH 01/16] Use another EXIF tag for the date if the default one is not available. --- redatepic.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/redatepic.sh b/redatepic.sh index fc6a606..9d3e9c3 100755 --- a/redatepic.sh +++ b/redatepic.sh @@ -26,7 +26,13 @@ while [ $1 ]; do if [[ -f ${REFERENCE} ]]; then # TAG=$(exif --ifd=EXIF -t "Date and Time (original)" ${REFERENCE} | grep Value) - TAG=$(exif --ifd=EXIF -t 0x9003 ${REFERENCE} | grep Value) + TAG=$(exif 2>/dev/null --ifd=EXIF -t 0x9003 ${REFERENCE} | grep Value) + + if [[ ! "${TAG}" ]]; then + echo >&2 " Cannot find the \"Date and Time (original)\" exif tag in ${REFERENCE}" + echo >&2 " Looking for \"Date and Time\"" + TAG=$(exif -t 0x0132 ${REFERENCE} | grep Value) + fi if [[ ${TAG} ]]; then TIMESTAMP=$(echo ${TAG} | sed -e \ -- 2.20.1 From 0c3c158e852076a6112a3137370f7634c0975048 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Sun, 14 Jun 2015 14:40:54 +0200 Subject: [PATCH 02/16] Check that the reference file is indeed an image, write less warnings. --- redatepic.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/redatepic.sh b/redatepic.sh index 9d3e9c3..3b9962d 100755 --- a/redatepic.sh +++ b/redatepic.sh @@ -23,15 +23,17 @@ while [ $1 ]; do REFERENCE=${NAME/MOV/JPG} - if [[ -f ${REFERENCE} ]]; then - + if [[ -f ${REFERENCE} ]] && file ${REFERENCE} | \grep -q image; then # TAG=$(exif --ifd=EXIF -t "Date and Time (original)" ${REFERENCE} | grep Value) TAG=$(exif 2>/dev/null --ifd=EXIF -t 0x9003 ${REFERENCE} | grep Value) if [[ ! "${TAG}" ]]; then - echo >&2 " Cannot find the \"Date and Time (original)\" exif tag in ${REFERENCE}" - echo >&2 " Looking for \"Date and Time\"" + # echo >&2 " Cannot find the \"Date and Time (original)\" exif tag in ${REFERENCE}" + # echo >&2 " Looking for \"Date and Time\"" TAG=$(exif -t 0x0132 ${REFERENCE} | grep Value) + # if [[ ${TAG} ]]; then + # echo >&2 " Ok, found!" + # fi fi if [[ ${TAG} ]]; then -- 2.20.1 From 46103bc8002cd6365de73e8a54481f1115f0f4c1 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Sun, 14 Jun 2015 14:41:24 +0200 Subject: [PATCH 03/16] Cosmetics. --- redatepic.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/redatepic.sh b/redatepic.sh index 3b9962d..3a379ab 100755 --- a/redatepic.sh +++ b/redatepic.sh @@ -28,12 +28,7 @@ while [ $1 ]; do TAG=$(exif 2>/dev/null --ifd=EXIF -t 0x9003 ${REFERENCE} | grep Value) if [[ ! "${TAG}" ]]; then - # echo >&2 " Cannot find the \"Date and Time (original)\" exif tag in ${REFERENCE}" - # echo >&2 " Looking for \"Date and Time\"" TAG=$(exif -t 0x0132 ${REFERENCE} | grep Value) - # if [[ ${TAG} ]]; then - # echo >&2 " Ok, found!" - # fi fi if [[ ${TAG} ]]; then @@ -42,7 +37,7 @@ while [ $1 ]; do touch -t $TIMESTAMP ${NAME} ls -l ${NAME} else - echo "++ No exif tag in ${NAME}, can not set the date properly." + echo "++ No proper exif tag for ${NAME}, can not set the date properly." fi else -- 2.20.1 From 1f8ae8cc1c0b654adb99d40e2ad7e40414074732 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Thu, 6 Aug 2015 19:40:08 -0700 Subject: [PATCH 04/16] Update. --- bashrc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 4ae13cb..adef316 100644 --- a/bashrc +++ b/bashrc @@ -54,6 +54,8 @@ shopt -s histappend setterm -blength 0 +# || setterm --blength 0 # Seriously? + ###################################################################### ## The interactive part @@ -367,7 +369,7 @@ function pho () { function dt () { echo "Local: $(date)" if [[ ${TZ} ]]; then - unset TZ + local TZ=$(cat /etc/timezone) echo "Home: $(date)" fi } @@ -884,7 +886,7 @@ PROMPT_COMMAND="prompt_command" # Displaying the timezone if it is set if [[ ${TZ} ]]; then - echo "${VT_BOLD}${VT_GREEN_FG}Time zone is ${TZ}.${VT_RESET}" + echo "${VT_BOLD}${VT_BLUE_FG}Time zone is ${TZ}.${VT_RESET}" fi ###################################################################### -- 2.20.1 From 8180bf9a04c1d1d7b362adbdac2982bdf2a76d6f Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 2 Oct 2015 22:05:21 +0200 Subject: [PATCH 05/16] Various updates. --- bashrc | 57 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/bashrc b/bashrc index adef316..4e2a151 100644 --- a/bashrc +++ b/bashrc @@ -52,7 +52,7 @@ shopt -s histappend # Remove the annoying beeps in console -setterm -blength 0 +# setterm -blength 0 # || setterm --blength 0 # Seriously? @@ -163,7 +163,7 @@ function latexdiff () { wdiff -n \ -w $'\033[30;41m' -x $'\033[0m' \ -y $'\033[30;42m' -z $'\033[0m' \ - $* + "$@" } # Looks for the most recent .log and pdflatex + bibtex the @@ -522,8 +522,8 @@ KEPT_COMMANDS=${HOME}/.kept_bash_commands function keep () { if [[ ${KEPT_COMMANDS} ]]; then TOKEEP=$(mktemp /tmp/keep.XXXXXX) - if [[ "$*" ]]; then - echo "$*" > ${TOKEEP} + if [[ "$@" ]]; then + echo "$@" > ${TOKEEP} else selector -b -i -d -l ${HISTSIZE} -o "${TOKEEP}" <(history) fi @@ -618,7 +618,7 @@ function ripdvd () { mkdir -p ${HOME}/dvds cd ${HOME}/dvds - time dvdbackup -i ${DVD_DEVICE} -v -M $* && eject + time dvdbackup -i ${DVD_DEVICE} -v -M "$@" && eject } alias ripcd=abcde @@ -634,7 +634,7 @@ function mksmall () { shift fi - [[ "${PARAMS}" ]] || PARAMS="-geometry 800x600" + [[ "${PARAMS}" ]] || PARAMS="-geometry 1280x1024" # Auto-orient does not seem to work at all, hence the ugly hack # with exif below @@ -818,11 +818,11 @@ function selector-printer () { # the current directory function lsn () { - LSN_MEMORY=".lsn-state" + [[ "${LSN_STATE_FILE}" ]] || LSN_STATE_FILE=".lsn-state" if [[ $1 == "--mem" ]] || [[ "$1" == "-m" ]]; then - \ls -pa | sort > ${LSN_MEMORY} + \ls -pa | sort > "${LSN_STATE_FILE}" echo "State updated." >&2 elif [[ $1 == "+" ]]; then @@ -830,32 +830,49 @@ function lsn () { shift TMP=$(mktemp /tmp/lsn.XXXXXX) - \ls -d $* > ${TMP} - cat ${LSN_MEMORY} >> ${TMP} - sort -u ${TMP} > ${LSN_MEMORY} + \ls -d "$@" > ${TMP} + cat "${LSN_STATE_FILE}" >> ${TMP} + sort ${TMP} | uniq -u > "${LSN_STATE_FILE}" \rm ${TMP} elif [[ "$1" ]]; then + cat >&2 < ...] - echo "lsn [--mem|-m] [+ ...]" >&2 - return 1 +Where + + --help|-h + prints this help + + --mem|-m + stores the current state of the directory + + + [ ...] + switches the presence/absence of the indicated files in the + stored state + +EOF + if [[ ! "$1" == "-h" ]] && [[ ! "$1" == "--help" ]]; then + echo >&2 "Unknown option \`\`$1''." + return 1 + fi else - if [[ -f ${LSN_MEMORY} ]]; then + if [[ -f "${LSN_STATE_FILE}" ]]; then TMP=$(mktemp /tmp/lsn.XXXXXX) \ls -pa | sort > ${TMP} - if diff > /dev/null ${TMP} ${LSN_MEMORY}; then - echo "${VT_GREEN_FG}${VT_BOLD}No change (since $(date +"%b %d, %Y" -r ${LSN_MEMORY}))${VT_RESET}" + if diff > /dev/null ${TMP} "${LSN_STATE_FILE}"; then + echo "${VT_GREEN_FG}${VT_BOLD}No change (since $(date +"%b %d, %Y" -r "${LSN_STATE_FILE}"))${VT_RESET}" else - \comm -1 -3 ${LSN_MEMORY} ${TMP} - \comm -2 -3 ${LSN_MEMORY} ${TMP} | while read line; do + \comm -1 -3 "${LSN_STATE_FILE}" ${TMP} + \comm -2 -3 "${LSN_STATE_FILE}" ${TMP} | while read line; do echo "${VT_RED_FG}${VT_BOLD}${line}${VT_RESET} (missing)" done fi \rm ${TMP} else - echo "No lsn state here." >&2 + echo "${VT_RED_FG}${VT_BOLD}No lsn state here.${VT_RESET}" >&2 return 1 fi @@ -886,7 +903,7 @@ PROMPT_COMMAND="prompt_command" # Displaying the timezone if it is set if [[ ${TZ} ]]; then - echo "${VT_BOLD}${VT_BLUE_FG}Time zone is ${TZ}.${VT_RESET}" + echo "${VT_BLUE_FG}Time zone is ${TZ}.${VT_RESET}" fi ###################################################################### -- 2.20.1 From d9930e7823c007964a023880587f23db98754eb8 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Mon, 2 Nov 2015 08:56:38 +0100 Subject: [PATCH 06/16] Update. --- bashrc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/bashrc b/bashrc index 4e2a151..fff96ac 100644 --- a/bashrc +++ b/bashrc @@ -761,7 +761,7 @@ function keep_local_history () { PS1="\[${VT_WHITE_BG}\]\${LOCAL_HISTORY_HINT}\[${VT_RESET}\]${PS1}" ###################################################################### -# Switch off the history +# Show the history path if it is unusual function histfile_cue () { if [[ ! "${HISTFILE}" == "${HOME}/.bash_history" ]]; then @@ -902,8 +902,6 @@ PROMPT_COMMAND="prompt_command" # Displaying the timezone if it is set -if [[ ${TZ} ]]; then - echo "${VT_BLUE_FG}Time zone is ${TZ}.${VT_RESET}" -fi +[[ ${TZ} ]] && echo "${VT_BLUE_FG}Time zone is ${TZ}.${VT_RESET}" ###################################################################### -- 2.20.1 From 006eaa8bf4b02876c790e0a4b1d8d7871c91d801 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 6 Nov 2015 10:01:02 +0100 Subject: [PATCH 07/16] Update. --- freeze-dir.sh | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100755 freeze-dir.sh diff --git a/freeze-dir.sh b/freeze-dir.sh new file mode 100755 index 0000000..5ae7015 --- /dev/null +++ b/freeze-dir.sh @@ -0,0 +1,75 @@ +#!/bin/bash + +######################################################################### +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the version 3 of the GNU General Public License # +# as published by the Free Software Foundation. # +# # +# This program is distributed in the hope that it will be useful, but # +# WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # +# General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +# Written by and Copyright (C) Francois Fleuret # +# Contact for comments & bug reports # +######################################################################### + +set -e + +[[ ${FREEZE_DIR} ]] || FREEZE_DIR=${HOME}/.backups + +if [[ ! -d ${FREEZE_DIR} ]]; then + echo "Can not find directory ${FREEZE_DIR}" >&2 + exit 1 +fi + +while [[ "$1" ]]; do + + dir=$(basename "$1") + path=$(dirname "$1") + full_path="${path}/${dir}" + + date=$(date +%Y_%b_%d_%H:%M:%S) + + if [[ ! -d "${full_path}" ]]; then + echo "Can not find directory ${full_path}" >&2 + exit 1 + fi + + if [[ $(find "${full_path}" -type f -name "core*" -o -name "vgcore.[0-9]*") ]]; then + # rm -i $(find "${full_path}" -type f -name "core" -o -name "vgcore.[0-9]*") + echo "There seems to be core files in ${full_path}" >&2 + exit 1 + fi + + backup="${FREEZE_DIR}/${full_path}" + + mkdir -p "${FREEZE_DIR}/${path}" + + current_backup="${backup}:::current" + new_backup="${backup}:::${date}" + + if [[ -h "${current_backup}" ]]; then + rsync --link-dest="${current_backup}/" -axz "${full_path}/" "${new_backup}/" + rm -f "${current_backup}" + else + if [[ -a ${current_backup} ]]; then + echo "${current_backup} exists and is not a symbolic link" >&2 + exit 1 + else + rsync -axz "${full_path}/" "${new_backup}/" + fi + fi + + ln -s "${new_backup}" "${current_backup}" + + sync + + du -sh "${new_backup}" + + shift + +done -- 2.20.1 From 0acec4f7f3292ea19e685c70ce9b300f0fe9c9c2 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 27 May 2016 18:52:05 +0200 Subject: [PATCH 08/16] Update. --- bashrc | 18 +++++++++++++----- freeze-dir.sh | 5 +++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/bashrc b/bashrc index fff96ac..dd9bc90 100644 --- a/bashrc +++ b/bashrc @@ -117,12 +117,21 @@ alias pd=pushd alias val='valgrind --leak-check=full --show-reachable=yes --db-attach=yes ' alias s='screen -d -R -U && clear' +alias p='feh --force-aliasing -d --full-screen --auto-zoom' function nh () { export HISTFILE=/dev/null unalias cd } +function select-tz () { + # Select a value for TZ + TMP=$(mktemp /tmp/select-tz.XXXXXX) + selector -o "${TMP}" <(grep -v ^# /usr/share/zoneinfo/zone.tab | awk '{print $3}' | sort -u) + cat "${TMP}" + \rm -f "${TMP}" +} + function ding () { if [[ $1 ]] && which winshepherd.sh; then play -q ~/local/sounds/deskbell.wav & @@ -326,6 +335,7 @@ function cdt () { } alias t='cd /tmp' +alias a='cd /tmp/at' function trash () { TRASH=$(date +/tmp/trash-%Y-%b-%d-%Hh) @@ -367,11 +377,9 @@ function pho () { ## A version of date that shows the time at home if TZ is set function dt () { - echo "Local: $(date)" - if [[ ${TZ} ]]; then - local TZ=$(cat /etc/timezone) - echo "Home: $(date)" - fi + echo "Local - $(date)" + unset TZ + echo "Home - $(date)" } ###################################################################### diff --git a/freeze-dir.sh b/freeze-dir.sh index 5ae7015..14c3070 100755 --- a/freeze-dir.sh +++ b/freeze-dir.sh @@ -17,6 +17,11 @@ # Contact for comments & bug reports # ######################################################################### +# This command makes a backup copy of a given directory into a backup +# directory, tags it with the date and time, and uses rsync +# intelligent features to avoid making superfluous copies of files +# which are already backuped. + set -e [[ ${FREEZE_DIR} ]] || FREEZE_DIR=${HOME}/.backups -- 2.20.1 From ffbc2bb60d0053e05a4da7874e7ee2cf4208c25e Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Sun, 21 Aug 2016 21:25:32 +0200 Subject: [PATCH 09/16] Update. --- bashrc | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/bashrc b/bashrc index dd9bc90..5e8a846 100644 --- a/bashrc +++ b/bashrc @@ -251,6 +251,40 @@ function bak () { done } +function scan () { + n=1 + + while [[ -f "${HOME}/scan-${n}.jpg" ]]; do + n=$((n+1)) + done + + while [[ "$1" ]]; do + if [[ "$1" == "color" ]]; then + OPTS+=" --mode=color" + elif [[ "$1" == "a4crop" ]]; then + OPTS+=" -l 5 -t 0 -x 200 -y 290" + else + echo "Unknown argument \`$1'" + fi + shift + done + + echo "**" + echo "** Scanning to ${HOME}/scan-${n}.jpg" + echo "**" + + scanimage -d genesys:libusb:001:056 \ + --format=pnm \ + --mode=color \ + --depth=8 \ + -v \ + --resolution=300 \ + ${OPTS} | \ + convert -rotate 180 - "${HOME}/scan-${n}.jpg" + + echo "** Done". +} + # A password generator function genpw () { @@ -338,7 +372,7 @@ alias t='cd /tmp' alias a='cd /tmp/at' function trash () { - TRASH=$(date +/tmp/trash-%Y-%b-%d-%Hh) + TRASH=$(date +/tmp/trash-${USER}-%Y-%b-%d-%Hh) LINK=/tmp/trash mkdir -p ${TRASH} -- 2.20.1 From f6faa7dc12bfe7c22f5dd11147f770bb8fa5bf9c Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Tue, 25 Oct 2016 10:49:29 +0200 Subject: [PATCH 10/16] Update. --- bashrc | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/bashrc b/bashrc index 5e8a846..b9a22d7 100644 --- a/bashrc +++ b/bashrc @@ -92,6 +92,10 @@ export LESS_TERMCAP_ue=${VT_RESET} export LESS_TERMCAP_md=${VT_BLUE_FG}${VT_BOLD} export LESS_TERMCAP_me=${VT_RESET} +# I do not like to clutter my home with history files + +export LESSHISTFILE=/dev/null + # export LESS_TERMCAP_md=$'\e[1;34;40m' # This prevents ^S from freezing the shell @@ -260,7 +264,9 @@ function scan () { while [[ "$1" ]]; do if [[ "$1" == "color" ]]; then - OPTS+=" --mode=color" + OPTS+=" --mode Color" + elif [[ "$1" == "gray" ]]; then + OPTS+=" --mode Gray" elif [[ "$1" == "a4crop" ]]; then OPTS+=" -l 5 -t 0 -x 200 -y 290" else @@ -273,7 +279,9 @@ function scan () { echo "** Scanning to ${HOME}/scan-${n}.jpg" echo "**" - scanimage -d genesys:libusb:001:056 \ + SCANNER=$(scanimage -L | grep "Canon LiDE 60" | sed -e "s/^.*\`\(.*\)'.*$/\1/") + + scanimage -d ${SCANNER} \ --format=pnm \ --mode=color \ --depth=8 \ @@ -924,6 +932,11 @@ EOF ###################################################################### function prompt_command () { + # if [[ ! "${CORE_CHECK_PWD}" == ${PWD} ]] && [[ $(find . -maxdepth 1 -name "core__*" -print -quit) ]]; then + + [[ "${CORE_CHECK_PWD}" == ${PWD} ]] || find . -maxdepth 1 -name "core__*" + CORE_CHECK_PWD=${PWD} + # if [[ $(umask) != 0022 ]]; then # echo "Umask changed to $(umask)" # fi -- 2.20.1 From d62cbf930001d3f99552ea853fe7aac2f88ecd8d Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Fri, 10 Feb 2017 17:47:42 +0100 Subject: [PATCH 11/16] Added the use of $PSCUE. --- bashrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bashrc b/bashrc index b9a22d7..5066b31 100644 --- a/bashrc +++ b/bashrc @@ -751,7 +751,9 @@ function mvtoconfig () { export PS1 if [[ "${CONSOLE}" == "yes" ]]; then + PS1="" + else # If the login is a standard one (as specified in @@ -786,6 +788,8 @@ else fi +PS1="${PSCUE}${PS1}" + ###################################################################### # This implements a local history. If we are in a directory containing # a writable local history file, we add the last line of the global -- 2.20.1 From c4d6a634221e8835fc27e3f0f3aded2d7a49a9fd Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Mon, 12 Jun 2017 09:55:25 +0200 Subject: [PATCH 12/16] Initial commit. --- arxiv-bib.sh | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100755 arxiv-bib.sh diff --git a/arxiv-bib.sh b/arxiv-bib.sh new file mode 100755 index 0000000..3654b3b --- /dev/null +++ b/arxiv-bib.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +######################################################################### +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the version 3 of the GNU General Public License # +# as published by the Free Software Foundation. # +# # +# This program is distributed in the hope that it will be useful, but # +# WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # +# General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +# Written by and Copyright (C) Francois Fleuret # +# Contact for comments & bug reports # +######################################################################### + + +set -e +set -o pipefail + +tmp=$(mktemp /tmp/arxiv-bib.sh.XXXXXX) + +curl > "${tmp}" "https://arxiv.org/abs/$1" + +AUTHORS="" + +while read line +do + [[ "${AUTHORS}" ]] && AUTHORS="${AUTHORS} and " + AUTHORS="${AUTHORS}${line}" +done < <(grep ' Date: Mon, 12 Jun 2017 09:55:28 +0200 Subject: [PATCH 13/16] Update. --- bashrc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/bashrc b/bashrc index 5066b31..b9cefb4 100644 --- a/bashrc +++ b/bashrc @@ -192,10 +192,10 @@ function rl () { if [[ -f "${FILEBASE}.tex" ]]; then - pdflatex "${FILEBASE}" + pdflatex --shell-escape "${FILEBASE}" bibtex "${FILEBASE}" - pdflatex "${FILEBASE}" - pdflatex "${FILEBASE}" + pdflatex --shell-escape "${FILEBASE}" + pdflatex --shell-escape "${FILEBASE}" if [[ "$1" ]]; then if [[ "$1" == "-v" ]] || [[ "$1" == "--view" ]]; then @@ -268,7 +268,9 @@ function scan () { elif [[ "$1" == "gray" ]]; then OPTS+=" --mode Gray" elif [[ "$1" == "a4crop" ]]; then - OPTS+=" -l 5 -t 0 -x 200 -y 290" + OPTS+=" -l 5 -t 0 -x 200 -y 300" + elif [[ "$1" == "help" ]] || [[ "$1" == "-h" ]] || [[ "$1" == "--help" ]]; then + echo "$0 [color|gray] [a4crop]" && return 0 else echo "Unknown argument \`$1'" fi @@ -936,9 +938,7 @@ EOF ###################################################################### function prompt_command () { - # if [[ ! "${CORE_CHECK_PWD}" == ${PWD} ]] && [[ $(find . -maxdepth 1 -name "core__*" -print -quit) ]]; then - - [[ "${CORE_CHECK_PWD}" == ${PWD} ]] || find . -maxdepth 1 -name "core__*" + [[ "${CORE_CHECK_PWD}" == ${PWD} ]] || find . -maxdepth 1 -name "core__*" | awk '{print "'${VT_RED_FG}'"$0"'${VT_RESET}'"}' CORE_CHECK_PWD=${PWD} # if [[ $(umask) != 0022 ]]; then -- 2.20.1 From fe32c67f02646ec69ffd440ef8ac26b04181e413 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Sat, 17 Jun 2017 12:48:07 +0200 Subject: [PATCH 14/16] Figure out a bibtex entry from a arxiv url or number. --- arxiv-bib.sh | 44 ++++++++++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/arxiv-bib.sh b/arxiv-bib.sh index 3654b3b..3097a79 100755 --- a/arxiv-bib.sh +++ b/arxiv-bib.sh @@ -23,28 +23,44 @@ set -o pipefail tmp=$(mktemp /tmp/arxiv-bib.sh.XXXXXX) -curl > "${tmp}" "https://arxiv.org/abs/$1" +while [[ "$1" ]] +do -AUTHORS="" + id="$1" -while read line -do - [[ "${AUTHORS}" ]] && AUTHORS="${AUTHORS} and " - AUTHORS="${AUTHORS}${line}" -done < <(grep ' "${tmp}" "https://arxiv.org/abs/${id}" + + AUTHORS="" + + while read line + do + [[ "${AUTHORS}" ]] && AUTHORS="${AUTHORS} and " + AUTHORS="${AUTHORS}${line}" + done < <(grep ' Date: Sat, 17 Jun 2017 12:48:33 +0200 Subject: [PATCH 15/16] Use the realpath instead of the provided filename. --- freeze-dir.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/freeze-dir.sh b/freeze-dir.sh index 14c3070..375db4b 100755 --- a/freeze-dir.sh +++ b/freeze-dir.sh @@ -32,9 +32,9 @@ if [[ ! -d ${FREEZE_DIR} ]]; then fi while [[ "$1" ]]; do - - dir=$(basename "$1") - path=$(dirname "$1") + real_path=$(realpath "$1") + dir=$(basename "${real_path}") + path=$(dirname "${real_path}") full_path="${path}/${dir}" date=$(date +%Y_%b_%d_%H:%M:%S) -- 2.20.1 From caef54051c89be32e693aeed90fa915f621fce47 Mon Sep 17 00:00:00 2001 From: Francois Fleuret Date: Sat, 17 Jun 2017 12:57:12 +0200 Subject: [PATCH 16/16] Cosmetics. --- freeze-dir.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/freeze-dir.sh b/freeze-dir.sh index 375db4b..81f4a6d 100755 --- a/freeze-dir.sh +++ b/freeze-dir.sh @@ -24,7 +24,10 @@ set -e -[[ ${FREEZE_DIR} ]] || FREEZE_DIR=${HOME}/.backups +# The default directory does not start with a period, as it may be +# huge and should not be "hidden" from the user. + +[[ ${FREEZE_DIR} ]] || FREEZE_DIR=${HOME}/freezer if [[ ! -d ${FREEZE_DIR} ]]; then echo "Can not find directory ${FREEZE_DIR}" >&2 @@ -32,7 +35,7 @@ if [[ ! -d ${FREEZE_DIR} ]]; then fi while [[ "$1" ]]; do - real_path=$(realpath "$1") + real_path="$(realpath "$1")" dir=$(basename "${real_path}") path=$(dirname "${real_path}") full_path="${path}/${dir}" -- 2.20.1