bt/btv as function
This commit is contained in:
parent
6263513f71
commit
a22f336245
81
.bashrc
81
.bashrc
|
@ -26,6 +26,12 @@ shopt -s checkwinsize
|
||||||
## autocd
|
## autocd
|
||||||
shopt -s autocd
|
shopt -s autocd
|
||||||
|
|
||||||
|
# make less more friendly for non-text input files, see lesspipe(1)
|
||||||
|
[ -x /usr/bin/lesspipe ] && eval "$(lesspipe)"
|
||||||
|
|
||||||
|
# LESS options
|
||||||
|
export LESS="-FRX"
|
||||||
|
|
||||||
# very basic prompt -- more in .bash_prompt
|
# very basic prompt -- more in .bash_prompt
|
||||||
PROMPT_COMMAND='PS1="[\u@\h] -- \w "; echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
|
PROMPT_COMMAND='PS1="[\u@\h] -- \w "; echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD/$HOME/~}\007"'
|
||||||
|
|
||||||
|
@ -38,8 +44,6 @@ export BROWSER=w3m
|
||||||
# ... and vim is the Best
|
# ... and vim is the Best
|
||||||
export EDITOR=vim
|
export EDITOR=vim
|
||||||
|
|
||||||
export PAGER=less
|
|
||||||
|
|
||||||
# very min bash aliases
|
# very min bash aliases
|
||||||
alias ls='ls -F --color'
|
alias ls='ls -F --color'
|
||||||
alias l='ls -l'
|
alias l='ls -l'
|
||||||
|
@ -51,7 +55,6 @@ alias wa='ssh warhol'
|
||||||
#
|
#
|
||||||
test -f ~/.bash_aliases && source ~/.bash_aliases
|
test -f ~/.bash_aliases && source ~/.bash_aliases
|
||||||
test -f ~/.bash_prompt && source ~/.bash_prompt
|
test -f ~/.bash_prompt && source ~/.bash_prompt
|
||||||
eval $(dircolors ~/.dircolors)
|
|
||||||
# shellcheck disable=SC2046
|
# shellcheck disable=SC2046
|
||||||
test -f ~/.dircolors && eval $(dircolors ~/.dircolors)
|
test -f ~/.dircolors && eval $(dircolors ~/.dircolors)
|
||||||
test -d ~/dotfiles/bash_completion && {
|
test -d ~/dotfiles/bash_completion && {
|
||||||
|
@ -62,26 +65,6 @@ test -d ~/dotfiles/bash_completion && {
|
||||||
done;
|
done;
|
||||||
}
|
}
|
||||||
|
|
||||||
# man in color with less
|
|
||||||
# from https://unix.stackexchange.com/questions/108699/documentation-on-less-termcap-variables
|
|
||||||
# export LESS_TERMCAP_mb=$'\e[5;31m' # blink
|
|
||||||
# export LESS_TERMCAP_md=$'\e[1;33m' # bold
|
|
||||||
# export LESS_TERMCAP_me=$'\e[0m' # no bold, blink, underline
|
|
||||||
# export LESS_TERMCAP_so=$'\e[7m' # reverse
|
|
||||||
# export LESS_TERMCAP_se=$'\e[27m' # no reverse
|
|
||||||
# export LESS_TERMCAP_us=$'\e[4;32m' # underline
|
|
||||||
# export LESS_TERMCAP_ue=$'\e[24m' # no underline
|
|
||||||
|
|
||||||
# https://wiki.archlinux.org/title/Color_output_in_console#Using_less
|
|
||||||
export MANPAGER="less -R --use-color -Dsc -Dk+r -Dd+g -Du+c -DPgb -DEbR"
|
|
||||||
export MANROFFOPT="-P -c"
|
|
||||||
|
|
||||||
# make less more friendly for non-text input files, see lesspipe(1)
|
|
||||||
[ -x /usr/bin/lesspipe.sh ] && eval "$(lesspipe.sh)"
|
|
||||||
|
|
||||||
# LESS options
|
|
||||||
#export LESS="-FRX"
|
|
||||||
|
|
||||||
# startship
|
# startship
|
||||||
# https://starship.rs/
|
# https://starship.rs/
|
||||||
type -t starship >/dev/null && {
|
type -t starship >/dev/null && {
|
||||||
|
@ -171,41 +154,11 @@ function _prepend_path() { _append_path -r "$1" "$2"; }
|
||||||
### rust
|
### rust
|
||||||
test -d "$HOME/.cargo/bin" && PATH=$(_prepend_path "$PATH" "$HOME/.cargo/bin")
|
test -d "$HOME/.cargo/bin" && PATH=$(_prepend_path "$PATH" "$HOME/.cargo/bin")
|
||||||
|
|
||||||
### nodejs
|
|
||||||
# test -d "$HOME/download/nodejs/latest/bin" && PATH=$(_prepend_path "$PATH" "$HOME/download/nodejs/latest/bin")
|
|
||||||
# test -d "$HOME/src/node/current/bin" && PATH=$(_prepend_path "$PATH" "$HOME/src/node/current/bin")
|
|
||||||
|
|
||||||
### npm in user mode
|
|
||||||
test -d "${HOME}/.npm-packages" || mkdir "${HOME}/.npm-packages"
|
|
||||||
export NPM_PACKAGES="${HOME}/.npm-packages"
|
|
||||||
PATH=$(_prepend_path "$PATH" "$NPM_PACKAGES/bin")
|
|
||||||
MANPATH=$(_append_path "$MANPATH" "$NPM_PACKAGES/share/man")
|
|
||||||
|
|
||||||
### yarn
|
|
||||||
# test -d "$HOME/src/yarn/latest/bin" && PATH=$(_prepend_path "$PATH" "$HOME/src/yarn/latest/bin")
|
|
||||||
|
|
||||||
### golang - default is $HOME/go/bin
|
### golang - default is $HOME/go/bin
|
||||||
export GOPATH="$HOME/go"
|
export GOPATH="$HOME/go"
|
||||||
test -d "$HOME"/go/bin && PATH=$(_prepend_path "$PATH" "$HOME/go/bin")
|
test -d "$HOME"/go/bin && PATH=$(_prepend_path "$PATH" "$HOME/go/bin")
|
||||||
|
|
||||||
### gobuffalo
|
|
||||||
type -t buffalo > /dev/null 2>&1 && eval "$(buffalo completion bash)"
|
|
||||||
|
|
||||||
function bt {
|
|
||||||
echo "bash bt $*"
|
|
||||||
local opt=
|
|
||||||
test "$#" -ne 0 && opt="-m ""$*"
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
buffalo test $opt | _gotestcolored | less -RF
|
|
||||||
}
|
|
||||||
function btv {
|
|
||||||
echo "bash btv $*"
|
|
||||||
local opt=
|
|
||||||
test "$#" -ne 0 && opt="-m ""$*"
|
|
||||||
# shellcheck disable=SC2086
|
|
||||||
buffalo test -v $opt | _gotestcolored | less -RF
|
|
||||||
}
|
|
||||||
|
|
||||||
# host specific bash
|
# host specific bash
|
||||||
test -r "$HOME/.bashrc-${HOSTNAME}" && source "$HOME/.bashrc-${HOSTNAME}"
|
test -r "$HOME/.bashrc-${HOSTNAME}" && source "$HOME/.bashrc-${HOSTNAME}"
|
||||||
|
|
||||||
|
@ -343,7 +296,7 @@ function faint () {
|
||||||
function openssl_check_all {
|
function openssl_check_all {
|
||||||
local file="$1"
|
local file="$1"
|
||||||
__openssl_check_all "$file"
|
__openssl_check_all "$file"
|
||||||
# local file2;file2=$(sed 's/\./_/g' <<<"$file")
|
|
||||||
local file2;file2=${file//./_}
|
local file2;file2=${file//./_}
|
||||||
test "$file" = "$file2" && return 0
|
test "$file" = "$file2" && return 0
|
||||||
file="$file2"
|
file="$file2"
|
||||||
|
@ -362,7 +315,7 @@ __openssl_check_all () {
|
||||||
# check Certificate Signing Request file
|
# check Certificate Signing Request file
|
||||||
function openssl_check_csr {
|
function openssl_check_csr {
|
||||||
test -f "$1" || { echo "Usage: $(basename "$0") <csr_file>"; return 1; }
|
test -f "$1" || { echo "Usage: $(basename "$0") <csr_file>"; return 1; }
|
||||||
faint "# openssl req -noout -text -verify -in $1 | grep Subject:"
|
faint "# openssl req -noout -text -verify -in $1"
|
||||||
openssl req -noout -text -verify -in "$1" | grep Subject:
|
openssl req -noout -text -verify -in "$1" | grep Subject:
|
||||||
faint "# openssl req -noout -modulus -in $1 | openssl md5 "
|
faint "# openssl req -noout -modulus -in $1 | openssl md5 "
|
||||||
openssl req -noout -modulus -in "$1" | openssl md5
|
openssl req -noout -modulus -in "$1" | openssl md5
|
||||||
|
@ -400,7 +353,7 @@ function openssl_check_protocol {
|
||||||
# check certificat file dates
|
# check certificat file dates
|
||||||
function openssl_check_cert_validity {
|
function openssl_check_cert_validity {
|
||||||
test -n "$1" || { echo "Usage: $(basename "$0") mon.site.example.com:443"; return 1; }
|
test -n "$1" || { echo "Usage: $(basename "$0") mon.site.example.com:443"; return 1; }
|
||||||
faint "# openssl s_client -servername ${1%:*} -connect $1 < /dev/null 2>/dev/null | openssl x509 -noout -dates"
|
faint "# openssl s_client -servername ${1%:*} -connect '$1' < /dev/null 2>/dev/null | openssl x509 -noout -dates"
|
||||||
openssl s_client -servername "${1%:*}" -connect "$1" < /dev/null 2>/dev/null | openssl x509 -noout -dates
|
openssl s_client -servername "${1%:*}" -connect "$1" < /dev/null 2>/dev/null | openssl x509 -noout -dates
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -429,8 +382,6 @@ function openssl_check_cert_validity {
|
||||||
|
|
||||||
faint "# openssl ocsp -issuer $onlychain_cert -cert $dest_cert -text -url $ocsp"
|
faint "# openssl ocsp -issuer $onlychain_cert -cert $dest_cert -text -url $ocsp"
|
||||||
openssl ocsp -issuer "$onlychain_cert" -cert "$dest_cert" -url "$ocsp" -text 2>/dev/null | grep "$dest_cert" 2>/dev/null | awk -F " " '{print $2}'
|
openssl ocsp -issuer "$onlychain_cert" -cert "$dest_cert" -url "$ocsp" -text 2>/dev/null | grep "$dest_cert" 2>/dev/null | awk -F " " '{print $2}'
|
||||||
|
|
||||||
# rm -rf "$dest_cert" "$chain_cert" "$onlychain_cert"
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,14 +402,14 @@ function vf {
|
||||||
}
|
}
|
||||||
|
|
||||||
function vfb {
|
function vfb {
|
||||||
pushd ~/bin > /dev/null
|
pushd ~/bin > /dev/null || exit
|
||||||
if test -n "$1"
|
if test -n "$1"
|
||||||
then
|
then
|
||||||
edit "$(fzf --multi --preview="cat {}" -q "$1")"
|
edit "$(fzf --multi --preview="cat {}" -q "$1")"
|
||||||
else
|
else
|
||||||
edit "$(fzf --multi --preview="cat {}" )"
|
edit "$(fzf --multi --preview="cat {}" )"
|
||||||
fi
|
fi
|
||||||
popd > /dev/null
|
popd > /dev/null || exit
|
||||||
}
|
}
|
||||||
|
|
||||||
function of {
|
function of {
|
||||||
|
@ -471,14 +422,14 @@ function of {
|
||||||
}
|
}
|
||||||
|
|
||||||
function odoc {
|
function odoc {
|
||||||
pushd ~/docs > /dev/null
|
pushd ~/docs > /dev/null || exit
|
||||||
if test -n "$1"
|
if test -n "$1"
|
||||||
then
|
then
|
||||||
see "$(fzf --preview="cat {}" -q "$1")"
|
see "$(fzf --preview="cat {}" -q "$1")"
|
||||||
else
|
else
|
||||||
see "$(fzf --preview="cat {}")"
|
see "$(fzf --preview="cat {}")"
|
||||||
fi
|
fi
|
||||||
popd > /dev/null
|
popd > /dev/null || exit
|
||||||
}
|
}
|
||||||
|
|
||||||
# Lorem ipsum
|
# Lorem ipsum
|
||||||
|
@ -567,10 +518,7 @@ then
|
||||||
PATH="/home/patrick/perl5/bin${PATH:+:${PATH}}"; export PATH;
|
PATH="/home/patrick/perl5/bin${PATH:+:${PATH}}"; export PATH;
|
||||||
PERL5LIB="/home/patrick/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
|
PERL5LIB="/home/patrick/perl5/lib/perl5${PERL5LIB:+:${PERL5LIB}}"; export PERL5LIB;
|
||||||
PERL_LOCAL_LIB_ROOT="/home/patrick/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
|
PERL_LOCAL_LIB_ROOT="/home/patrick/perl5${PERL_LOCAL_LIB_ROOT:+:${PERL_LOCAL_LIB_ROOT}}"; export PERL_LOCAL_LIB_ROOT;
|
||||||
# shellcheck disable=2089
|
PERL_MB_OPT="--install_base /home/patrick/perl5"; export PERL_MB_OPT;
|
||||||
PERL_MB_OPT='--install_base "/home/patrick/perl5"'
|
|
||||||
# shellcheck disable=2090
|
|
||||||
export PERL_MB_OPT;
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# pyenv
|
# pyenv
|
||||||
|
@ -588,3 +536,4 @@ export SHELLCHECK_OPTS="-x"
|
||||||
|
|
||||||
echo "<< .bashrc"
|
echo "<< .bashrc"
|
||||||
# end .bashrc
|
# end .bashrc
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue