[[ "${MANPATH}" ]] || MANPATH=$(manpath)
+export EDITOR='emacs -nw'
+export GIT_EDITOR=${EDITOR}
+
# If the private bashrc exists, execute it
[[ -f "${PRIVATE_BASHRC}" ]] && source "${PRIVATE_BASHRC}"
export HISTTIMEFORMAT=""
shopt -s histappend
+shopt -s autocd
# I realized that most of my settings are meaningful only in
# interactive mode. This should maybe be done more properly through
# using different .bash_profile and .bash_login
+######################################################################
+
+# added by Miniconda3 installer
+export PATH="${HOME}/conda/bin:$PATH"
+
[ ${TERM} == "dumb" ] || [[ ! -t 0 ]] && return
# Remove the annoying beeps in console
alias p='feh --force-aliasing -d --full-screen --auto-zoom'
alias gp=gnuplot
+function ext () {
+ find . -maxdepth 1 -type f | \grep \. | sed -e 's/^.*\.\([^/.]*\)$/\1/'
+}
+
+# function catscan () {
+ # convert signal-attachment-2020-06-01-192843.jpeg signal-attachment-2020-06-01-192829.jpeg -quality 25 -sigmoidal-contrast 10,45% -page a4 scan.pdf
+# }
+
+function trash-later () {
+ dir=${HOME}/misc/trash-later/remove-after-$(date --date='+3 months' +%Y-%b-%d)
+ mkdir -p "${dir}"
+ pushd "${dir}"
+}
+
function nh () {
export HISTFILE=/dev/null
unalias cd
alias l='ls -p -I "*~" -I "*.o"'
fi
-export EDITOR=emacsclient
-export GIT_EDITOR=${EDITOR}
-
######################################################################
# Ignored extensions when completing
# A password generator
function genpw () {
- PW=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c16)
+ if [[ "$1" == "-e" ]]
+ then
+ PW=$(tr -dc A-Z0-9 < /dev/urandom | head -c6)
+ shift
+ else
+ PW=$(tr -dc A-Za-z0-9 < /dev/urandom | head -c16)
+ fi
if [[ ! "$1" == "-s" ]]
then
echo "$(date) ${PW}" >> ${HOME}/private/genpw.log
then
name=$2
else
- name="capture-$(date +%s).png"
+ name="capture-$(date +%Y%m%d-%H%M%S).png"
fi
if [[ "$1" ]]
alias a='cd /tmp/at'
function trash () {
- TRASH=$(date +/tmp/trash-${USER}-%Y-%b-%d-%Hh)
- LINK=/tmp/trash
- mkdir -p ${TRASH}
-
- [[ -h ${LINK} ]] && \rm ${LINK}
+ [[ "${TRASH_LATER_ROOT}" ]] || TRASH_LATER_ROOT="${HOME}/.trash"
- [[ ! -f ${LINK} ]] && ln -s ${TRASH} ${LINK}
+ if [[ "$1" == "--" ]]
+ then
+ shift
+ elif [[ "$1" == "-l" ]]
+ then
+ shift
+ echo "Trashin in 3 months"
+ TRASH_DIR="${TRASH_LATER_ROOT}/remove-after-$(date --date='+3 months' +%Y-%b-%d)"
+ mkdir -p "${TRASH_DIR}"
+ else
+ TRASH_DIR=$(date +/tmp/trash-${USER}-%Y-%b-%d-%Hh)
+ LINK=/tmp/trash
+ mkdir -p ${TRASH_DIR}
+ [[ -h ${LINK} ]] && \rm ${LINK}
+ [[ ! -f ${LINK} ]] && ln -s ${TRASH_DIR} ${LINK}
+ fi
- mv "$@" ${TRASH}
+ mv "$@" "${TRASH_DIR}"
echo "Trashed $@"
}
return 0
fi
- if \ifconfig -s | grep -q -v ^'(Iface|lo) '
+ if \ifconfig -s | grep -q -v ^'(Iface|lo|docker[0-9]) '
then
echo "There is/are already interface(s) up." >&2
return 1
return 1
fi
- echo "Attemptin to rip from ${DVD_DEVICE}."
+ echo "Attempting to rip from ${DVD_DEVICE}."
mkdir -p ${HOME}/dvds
fi
}
+
+######################################################################
+# git prompt
+
+if which > /dev/null git
+then
+
+ parse_git_branch() {
+ git 2>/dev/null rev-parse --abbrev-ref HEAD | sed -e 's/^\(.*\)$/(\1) /'
+ }
+
+ export PS_GIT="${VT_GREEN_FG}\$(parse_git_branch)"
+fi
+
######################################################################
# The complex prompt policy
[[ "${IDENT}" ]] && IDENT="${IDENT}:"
+ # IDENT="${PS_GIT}${VT_BLACK_FG}${IDENT}"
+
if [[ ${USER} == "root" ]]
then
# If we are root, show that in red
fi
-PS1="${PSCUE}${PS1}"
+#PS1="${PSCUE}${PS1}"
######################################################################
# This implements a local history. If we are in a directory containing
######################################################################
source /usr/share/bash-completion/bash_completion
-
-######################################################################
-
-# added by Miniconda3 installer
-export PATH="/home/fleuret/conda/bin:$PATH"