add bash in current form
This commit is contained in:
commit
3065a9db72
5 changed files with 170 additions and 0 deletions
10
bash/.bash_aliases
Normal file
10
bash/.bash_aliases
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# vim: set ft=sh:
|
||||||
|
|
||||||
|
alias myip="curl http://ip.ie.mk/get"
|
||||||
|
alias ls="ls --color"
|
||||||
|
alias grep="grep --color"
|
||||||
|
alias virsh="virsh --connect qemu:///system"
|
||||||
|
alias cal="cal -m"
|
||||||
|
alias genpasswd="strings /dev/urandom | tr -cd '12345!@#$%qwertQWERTasdfgASDFGzxcvbZXCVB' | head -c 32; echo"
|
||||||
|
alias du="dust -r"
|
||||||
|
alias jsonpp="python -m json.tool"
|
74
bash/.bash_colors
Normal file
74
bash/.bash_colors
Normal file
|
@ -0,0 +1,74 @@
|
||||||
|
# vim: set ft=sh:
|
||||||
|
|
||||||
|
# Reset
|
||||||
|
Off='\e[0m' # Text Reset
|
||||||
|
|
||||||
|
# Regular Colors
|
||||||
|
Black='\e[0;30m' # Black
|
||||||
|
Red='\e[0;31m' # Red
|
||||||
|
Green='\e[0;32m' # Green
|
||||||
|
Yellow='\e[0;33m' # Yellow
|
||||||
|
Blue='\e[0;34m' # Blue
|
||||||
|
Purple='\e[0;35m' # Purple
|
||||||
|
Cyan='\e[0;36m' # Cyan
|
||||||
|
White='\e[0;37m' # White
|
||||||
|
|
||||||
|
# Bold
|
||||||
|
BBlack='\e[1;30m' # Black
|
||||||
|
BRed='\e[1;31m' # Red
|
||||||
|
BGreen='\e[1;32m' # Green
|
||||||
|
BYellow='\e[1;33m' # Yellow
|
||||||
|
BBlue='\e[1;34m' # Blue
|
||||||
|
BPurple='\e[1;35m' # Purple
|
||||||
|
BCyan='\e[1;36m' # Cyan
|
||||||
|
BWhite='\e[1;37m' # White
|
||||||
|
|
||||||
|
# Underline
|
||||||
|
UBlack='\e[4;30m' # Black
|
||||||
|
URed='\e[4;31m' # Red
|
||||||
|
UGreen='\e[4;32m' # Green
|
||||||
|
UYellow='\e[4;33m' # Yellow
|
||||||
|
UBlue='\e[4;34m' # Blue
|
||||||
|
UPurple='\e[4;35m' # Purple
|
||||||
|
UCyan='\e[4;36m' # Cyan
|
||||||
|
UWhite='\e[4;37m' # White
|
||||||
|
|
||||||
|
# Background
|
||||||
|
On_Black='\e[40m' # Black
|
||||||
|
On_Red='\e[41m' # Red
|
||||||
|
On_Green='\e[42m' # Green
|
||||||
|
On_Yellow='\e[43m' # Yellow
|
||||||
|
On_Blue='\e[44m' # Blue
|
||||||
|
On_Purple='\e[45m' # Purple
|
||||||
|
On_Cyan='\e[46m' # Cyan
|
||||||
|
On_White='\e[47m' # White
|
||||||
|
|
||||||
|
# High Intensity
|
||||||
|
IBlack='\e[0;90m' # Black
|
||||||
|
IRed='\e[0;91m' # Red
|
||||||
|
IGreen='\e[0;92m' # Green
|
||||||
|
IYellow='\e[0;93m' # Yellow
|
||||||
|
IBlue='\e[0;94m' # Blue
|
||||||
|
IPurple='\e[0;95m' # Purple
|
||||||
|
ICyan='\e[0;96m' # Cyan
|
||||||
|
IWhite='\e[0;97m' # White
|
||||||
|
|
||||||
|
# Bold High Intensity
|
||||||
|
BIBlack='\e[1;90m' # Black
|
||||||
|
BIRed='\e[1;91m' # Red
|
||||||
|
BIGreen='\e[1;92m' # Green
|
||||||
|
BIYellow='\e[1;93m' # Yellow
|
||||||
|
BIBlue='\e[1;94m' # Blue
|
||||||
|
BIPurple='\e[1;95m' # Purple
|
||||||
|
BICyan='\e[1;96m' # Cyan
|
||||||
|
BIWhite='\e[1;97m' # White
|
||||||
|
|
||||||
|
# High Intensity backgrounds
|
||||||
|
On_IBlack='\e[0;100m' # Black
|
||||||
|
On_IRed='\e[0;101m' # Red
|
||||||
|
On_IGreen='\e[0;102m' # Green
|
||||||
|
On_IYellow='\e[0;103m' # Yellow
|
||||||
|
On_IBlue='\e[0;104m' # Blue
|
||||||
|
On_IPurple='\e[0;105m' # Purple
|
||||||
|
On_ICyan='\e[0;106m' # Cyan
|
||||||
|
On_IWhite='\e[0;107m' # White
|
22
bash/.bash_functions
Normal file
22
bash/.bash_functions
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
# vim: set ft=sh:
|
||||||
|
|
||||||
|
iploc () {
|
||||||
|
curl -s "http://ip-api.com/json/${1}" | tr ',' '\n' | sed 's/[\"{}]//g'
|
||||||
|
}
|
||||||
|
|
||||||
|
function parse_branch {
|
||||||
|
scmexe=${1:-git}
|
||||||
|
$scmexe branch 2> /dev/null | awk '/^*/{$1="";sub(/^ /, "");print "("$0")"}'
|
||||||
|
}
|
||||||
|
|
||||||
|
function appendpath {
|
||||||
|
if ! [[ "$PATH" =~ $1 ]]
|
||||||
|
then
|
||||||
|
PATH="$1:$PATH"
|
||||||
|
fi
|
||||||
|
export PATH
|
||||||
|
}
|
||||||
|
|
||||||
|
yell() { echo "$0: $*" >&2; }
|
||||||
|
die() { yell "$*"; exit 1; }
|
||||||
|
try() { "$@" || die "failed while trying to: $*"; }
|
17
bash/.bash_profile
Normal file
17
bash/.bash_profile
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
# vim: set ft=sh:
|
||||||
|
|
||||||
|
EDITOR=nvim
|
||||||
|
GIT_EDITOR=$EDITOR
|
||||||
|
HISTCONTROL=ignoredups:erasedups # Avoid duplicates
|
||||||
|
HISTFILESIZE=100000000 # big big history
|
||||||
|
HISTSIZE=100000000 # big big history
|
||||||
|
LIBVIRT_DEFAULT_URI='qemu:///system'
|
||||||
|
MANWIDTH=80
|
||||||
|
RIPGREP_CONFIG_PATH=$HOME/.ripgreprc
|
||||||
|
SYSTEMD_EDITOR=$EDITOR
|
||||||
|
TERM=alacritty
|
||||||
|
|
||||||
|
[[ -f ~/.bashrc ]] && . ~/.bashrc
|
||||||
|
|
||||||
|
# opam configuration
|
||||||
|
test -r /home/vladan/.opam/opam-init/init.sh && . /home/vladan/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true
|
47
bash/.bashrc
Normal file
47
bash/.bashrc
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# vim: set ft=sh:
|
||||||
|
|
||||||
|
# If not running interactively, don't do anything.
|
||||||
|
[[ $- != *i* ]] && return
|
||||||
|
|
||||||
|
# Source global definitions.
|
||||||
|
if [ -f /etc/bashrc ]; then
|
||||||
|
. /etc/bashrc
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Append to history, don't overwrite.
|
||||||
|
shopt -s histappend
|
||||||
|
|
||||||
|
# Load customizations.
|
||||||
|
[[ -f $HOME/.bash_aliases ]] && source "$HOME/.bash_aliases"
|
||||||
|
[[ -f $HOME/.bash_colors ]] && source "$HOME/.bash_colors"
|
||||||
|
[[ -f $HOME/.bash_functions ]] && source "$HOME/.bash_functions"
|
||||||
|
|
||||||
|
# Set up python env.
|
||||||
|
export PYTHONDONTWRITEBYTECODE=1
|
||||||
|
export PYTHONUSERBASE=$HOME/.env/python
|
||||||
|
|
||||||
|
# Local user bins
|
||||||
|
appendpath $HOME/.local/bin
|
||||||
|
appendpath $HOME/.cargo/bin
|
||||||
|
appendpath $HOME/.env/python/bin
|
||||||
|
|
||||||
|
# Save working dir on every prompt.
|
||||||
|
export PROMPT_COMMAND='pwd > $HOME/.cwd'
|
||||||
|
export PS1="${Yellow}\d \A ${Off}${Green}\u@\h: ${Off}\w ${Red}\$(parse_branch git)${BRed}\$(parse_branch fossil)${Off}\n-$ "
|
||||||
|
|
||||||
|
# Use fzf if installed.
|
||||||
|
hash fzf 2>/dev/null && eval "$(fzf --bash)"
|
||||||
|
export FZF_COMPLETION_OPTS='--border --info=inline'
|
||||||
|
|
||||||
|
# Change to saved working dir.
|
||||||
|
[[ -f "${HOME}/.cwd" ]] && cd "$(< ${HOME}/.cwd)"
|
||||||
|
|
||||||
|
# Use gpg-agent as ssh agent (and get a nice graphical prompt).
|
||||||
|
unset SSH_AGENT_PID
|
||||||
|
if [ "${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then
|
||||||
|
SSH_AUTH_SOCK=$(gpgconf --list-dirs agent-ssh-socket)
|
||||||
|
export SSH_AUTH_SOCK
|
||||||
|
fi
|
||||||
|
GPG_TTY=$(tty)
|
||||||
|
export GPG_TTY
|
||||||
|
gpg-connect-agent updatestartuptty /bye >/dev/null
|
Loading…
Reference in a new issue