Created
February 20, 2019 15:15
-
-
Save aernesto/8b74e329f1ecccd18404127f3f9e0e3f to your computer and use it in GitHub Desktop.
my ~/.bashrc file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
# git | |
source ~/.git-prompt.sh # copied from https://github.com/git/git/blob/master/contrib/completion/git-prompt.sh | |
alias glog="git log --oneline --graph --all --decorate" | |
alias gis="git status" | |
alias fec="git fetch --all" | |
alias pushh="git push origin HEAD" | |
function diag(){ | |
echo " | |
=======FETCH========= | |
" | |
git fetch --all | |
echo " | |
=======STATUS========= | |
" | |
git status | |
echo " | |
=======GLOG========= | |
" | |
git log --oneline --graph --all --decorate -10 | |
echo " | |
=======END========= | |
" | |
} | |
# prompt with git status | |
export GIT_PS1_SHOWDIRTYSTATE=1 | |
export GIT_PS1_SHOWCOLORHINTS=1 | |
export GIT_PS1_SHOWUNTRACKEDFILES=1 | |
PROMPT_COMMAND='__git_ps1 "[\u@\h:$PWD/" "]\\n ($CONDA_DEFAULT_ENV)\$ "' # long version with several line jumps | |
#PROMPT_COMMAND='__git_ps1 "\u:\W" "\\\$ "' # short version without line jump | |
#PS1='\u:\W/\$ ' # this is standard Linux prompt without git status | |
# Uncomment the following line if you don't like systemctl's auto-paging feature: | |
# export SYSTEMD_PAGER= | |
export LANGUAGE=en_US.utf8 | |
# shell | |
alias ls="ls -lFGh" | |
alias rm="rm -vi" | |
alias mv="mv -vi" | |
alias cp="cp -vi" | |
# Vim | |
alias vi="vimx" | |
alias vim="vimx" | |
# indiek | |
indiek_PATH="/home/adrian/IndieK/shell_scripts/functions" | |
if [ -d "$indiek_PATH/" ]; then | |
# CONSTANTS | |
current_db_name=$( grep database ~/.my.cnf | sed 's/database=\(.*\)/\1/g' ) | |
indiek_base_folder="${HOME}/.indiek/$current_db_name" | |
indiek_tmp="${HOME}/.indiek/tmp" | |
indiek_images="$indiek_base_folder/images" | |
# This uses EDITOR as editor, or vi if EDITOR is null or unset | |
EDITOR=${EDITOR:-vimx} | |
# auxiliary functions | |
source $indiek_PATH/die.sh | |
source $indiek_PATH/get_supratopics.sh | |
source $indiek_PATH/get_subtopics.sh | |
source $indiek_PATH/istopic.sh | |
source $indiek_PATH/setindiekdb.sh | |
# main commands functions | |
source $indiek_PATH/t.sh | |
source $indiek_PATH/topic.sh | |
source $indiek_PATH/i.sh | |
source $indiek_PATH/newtopic.sh | |
source $indiek_PATH/nt.sh | |
source $indiek_PATH/ntx.sh | |
source $indiek_PATH/showtopic.sh | |
source $indiek_PATH/sub.sh | |
source $indiek_PATH/subtopic.sh | |
source $indiek_PATH/compile.sh | |
source $indiek_PATH/gr.sh | |
source $indiek_PATH/grt.sh | |
source $indiek_PATH/searchitem.sh | |
source $indiek_PATH/intopic.sh | |
source $indiek_PATH/notintopic.sh | |
source $indiek_PATH/searchtopic.sh | |
source $indiek_PATH/edititem.sh | |
source $indiek_PATH/deleteitem.sh | |
source $indiek_PATH/showitem.sh | |
source $indiek_PATH/si.sh | |
fi | |
# stopwatch and countdown functions | |
# ref: https://superuser.com/a/611582 | |
function countdown(){ | |
date1=$((`date +%s` + $1)); | |
while [ "$date1" -ge `date +%s` ]; do | |
echo -ne "$(date -u --date @$(($date1 - `date +%s`)) +%H:%M:%S)\r"; | |
sleep 0.1 | |
done | |
} | |
function stopwatch(){ | |
date1=`date +%s`; | |
while true; do | |
echo -ne "$(date -u --date @$((`date +%s` - $date1)) +%H:%M:%S)\r"; | |
sleep 0.1 | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment