Udate bashrc

This commit is contained in:
Evan Reichard 2020-10-22 10:30:03 -04:00
parent a04e3b7154
commit cccff807d8

41
.bashrc
View File

@ -1,37 +1,56 @@
# ALIASES # ------------------------------------------------------------------------------
# ---------------------------------- ALIASES -----------------------------------
# ------------------------------------------------------------------------------
alias grep="grep --color" alias grep="grep --color"
alias vim="/Applications/MacVim.app/Contents/bin/mvim -v" alias vim="/Applications/MacVim.app/Contents/bin/mvim -v"
alias utcclock="TZ=UTC vtclock" alias vi="/Applications/MacVim.app/Contents/bin/mvim -v"
alias urldecode='python -c "import sys, urllib as ul; \ alias urldecode='python -c "import sys, urllib as ul; \
print ul.unquote_plus(sys.argv[1])"' print ul.unquote_plus(sys.argv[1])"'
alias urlencode='python -c "import sys, urllib as ul; \ alias urlencode='python -c "import sys, urllib as ul; \
print ul.quote_plus(sys.argv[1])"' print ul.quote_plus(sys.argv[1])"'
# FUNCTIONS # ------------------------------------------------------------------------------
# --------------------------------- FUNCTIONS ----------------------------------
# ------------------------------------------------------------------------------
function cache {
cmd="$*"
name=$(echo "$PWD-$cmd" | base64)
if [[ -f ~/.bash-cache/$name.exit ]] && [[ $(cat ~/.bash-cache/$name.exit) -eq 0 ]]; then
printf "CACHED:\n\n"
else
mkdir -p ~/.bash-cache
eval "$cmd" > ~/.bash-cache/$name.out
echo $? > ~/.bash-cache/$name.exit
fi
cat ~/.bash-cache/$name.out
}
function sfind(){ function sfind(){
find . -name "$1" -print0 | xargs -0 grep "$2" find . -name "$1" -print0 | xargs -0 grep "$2"
} }
function phow(){ function phow(){
curl https://cht.sh/$1/$2?Q curl https://cht.sh/$1/$2?Q
} }
function csv2mdt(){ function csv2mdt(){
cat $1 | sed 1p | LC_ALL=C sed -e 's/,/ |\&nbsp\;\&nbsp\; /g' -e 's/^/| /g' -e 's/$/ |/g' -e '2 s/[^|]/-/g' | LC_ALL=C tr -d $'\r' cat $1 | sed 1p | LC_ALL=C sed -e 's/,/ |\&nbsp\;\&nbsp\; /g' -e 's/^/| /g' -e 's/$/ |/g' -e '2 s/[^|]/-/g' | LC_ALL=C tr -d $'\r'
} }
# EXPORTS # ------------------------------------------------------------------------------
export PATH=/opt/local/bin:/opt/local/sbin:$PATH # ---------------------------------- EXPORTS -----------------------------------
export PATH=$PATH:$HOME/Library/Python/2.7/bin # ------------------------------------------------------------------------------
# export PS1="\[\e[00;31m\][\h]\[\e[0m\]\[\e[00;37m\] \[\e[0m\]\[\e[00;32m\]\u\[\e[0m\]\[\e[00;37m\] \[\e[0m\]\[\e[00;34m\][\w]\[\e[0m\]\[\e[00;37m\]\n [\#] \\$ \[\e[0m\]" export PATH=$HOME/.local/bin:$HOME/Library/Python/3.7/bin:$HOME/Library/Python/2.7/bin:/opt/local/bin:/opt/local/sbin:$PATH
export TERM=xterm-256color export TERM=xterm-256color
export KUBE_EDITOR="/Applications/MacVim.app/Contents/bin/mvim -v"
# POWERLINE # ------------------------------------------------------------------------------
# --------------------------------- POWERLINE ----------------------------------
# ------------------------------------------------------------------------------
powerline-daemon -q powerline-daemon -q
POWERLINE_BASH_CONTINUATION=1 POWERLINE_BASH_CONTINUATION=1
POWERLINE_BASH_SELECT=1 POWERLINE_BASH_SELECT=1
. /Users/evanreichard/Library/Python/2.7/lib/python/site-packages/powerline/bindings/bash/powerline.sh . /Users/evanreichard/Library/Python/2.7/lib/python/site-packages/powerline/bindings/bash/powerline.sh
# TMUX & NEOFETCH # ------------------------------------------------------------------------------
# ------------------------------ TMUX & NEOFETCH -------------------------------
# ------------------------------------------------------------------------------
[ ! -z $TMUX ] || tmux a || tmux [ ! -z $TMUX ] || tmux a || tmux
neofetch neofetch