# -*-Shell-script-*-
+# PS4='+ $(date "+%s.%N")\011 '
+# set -x
+
#########################################################################
# 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 #
[[ "${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/fleuret/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 obs () {
+ dir=${HOME}/misc/use-by-$(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
then
if [[ "$1" == "-v" ]] || [[ "$1" == "--view" ]]
then
- xpdf "${FILEBASE}.pdf"
+ # xpdf "${FILEBASE}.pdf"
+ zathura "${FILEBASE}.pdf"
elif [[ "$1" == "-p" ]] || [[ "$1" == "--print" ]]
then
lpr "${FILEBASE}.pdf"
# 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" ]]
fi
echo "Please click on the window to capture."
- xwd | convert - ${name}
+ xwd | convert xwd:- ${name}
\ls -l ${name}
}
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_ROOT}" ]] || TRASH_ROOT="${HOME}/.trash"
- [[ ! -f ${LINK} ]] && ln -s ${TRASH} ${LINK}
+ if [[ "$1" == "--" ]]
+ then
+ shift
+ elif [[ "$1" == "-t" ]]
+ then
+ shift
+ TRASH_DIR="${TRASH_ROOT}"
+ 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 $@"
}
}
######################################################################
-## ifup / ifdown with sudo and memorization of the network
-
-## When invoked without an argument netup uses the same argument as
-## the previous time
-
-## When invoked without an argument netdown removes the last interface
-## which was netuped
+## ifup / ifdown with sudo
[ ${NETUP_HISTORY} ] || NETUP_HISTORY="${HOME}/.netup_history"
# multiple shells are open
history -a
# load the saved history
- history -n
+ # history -n
# and the local histories system defined above
keep_local_history
# and the history cue
[[ ${TZ} ]] && echo "${VT_BLUE_FG}Time zone is ${TZ}.${VT_RESET}"
######################################################################
+
+source /usr/share/bash-completion/bash_completion