Last active
September 15, 2017 14:47
-
-
Save sirolf2009/ce64d5d343e8cb35c86a27f76ada01dc to your computer and use it in GitHub Desktop.
Note to fill in your own gmail creds
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: executed by bash(1) for non-login shells. | |
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) | |
# for examples | |
# If not running interactively, don't do anything | |
case $- in | |
*i*) ;; | |
*) return;; | |
esac | |
# don't put duplicate lines or lines starting with space in the history. | |
# See bash(1) for more options | |
HISTCONTROL=ignoreboth | |
# append to the history file, don't overwrite it | |
shopt -s histappend | |
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1) | |
HISTSIZE=1000 | |
HISTFILESIZE=2000 | |
# check the window size after each command and, if necessary, | |
# update the values of LINES and COLUMNS. | |
shopt -s checkwinsize | |
# If set, the pattern "**" used in a pathname expansion context will | |
# match all files and zero or more directories and subdirectories. | |
#shopt -s globstar | |
# make less more friendly for non-text input files, see lesspipe(1) | |
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" | |
# set variable identifying the chroot you work in (used in the prompt below) | |
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then | |
debian_chroot=$(cat /etc/debian_chroot) | |
fi | |
# set a fancy prompt (non-color, unless we know we "want" color) | |
case "$TERM" in | |
xterm-color|*-256color) color_prompt=yes;; | |
esac | |
# enable color support of ls and also add handy aliases | |
if [ -x /usr/bin/dircolors ]; then | |
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" | |
alias ls='ls -lh --color=auto' | |
#alias dir='dir --color=auto' | |
#alias vdir='vdir --color=auto' | |
#alias grep='grep --color=auto' | |
#alias fgrep='fgrep --color=auto' | |
#alias egrep='egrep --color=auto' | |
fi | |
# colored GCC warnings and errors | |
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01' | |
# some more ls aliases | |
alias ll='ls -l' | |
#alias la='ls -A' | |
#alias l='ls -CF' | |
# Alias definitions. | |
# You may want to put all your additions into a separate file like | |
# ~/.bash_aliases, instead of adding them here directly. | |
# See /usr/share/doc/bash-doc/examples in the bash-doc package. | |
if [ -f ~/.bash_aliases ]; then | |
. ~/.bash_aliases | |
fi | |
# enable programmable completion features (you don't need to enable | |
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile | |
# sources /etc/bash.bashrc). | |
if ! shopt -oq posix; then | |
if [ -f /usr/share/bash-completion/bash_completion ]; then | |
. /usr/share/bash-completion/bash_completion | |
elif [ -f /etc/bash_completion ]; then | |
. /etc/bash_completion | |
fi | |
fi | |
function mail() { | |
username="GMAIL USERNAME" | |
password="GMAIL PASSWORD" | |
curl -u $username:$password --silent "https://mail.google.com/mail/feed/atom" | grep -oPm1 "(?<=<title>)[^<]+" | sed '1d' | |
} | |
function mailbit() { | |
mail=$(mail | wc -l) | |
if [ $mail != "0" ]; then | |
echo "[$(echo $mail) new mail]═" | |
else | |
echo "" | |
fi | |
} | |
function btc() { | |
cat ~/.btcusd | |
} | |
if [ "0" -eq "$(crontab -l | grep '* * * * * curl -sS https://api.bitfinex.com/v1/ticker/BTCUSD | jq -r ".mid" > ~/.btcusd' | wc -l)" ]; then | |
crontab -l > ~/.mycron | |
echo '* * * * * curl -sS https://api.bitfinex.com/v1/ticker/BTCUSD | jq -r ".mid" > ~/.btcusd' >> ~/.mycron | |
crontab ~/.mycron | |
rm ~/.mycron | |
echo "A cron job has been installed to pull the BTC price" | |
fi | |
function set_bash_prompt() { | |
PS1="╔═$(mailbit)[\[\e[33;1m\]฿ $(btc)\[\e[m\]]═[\[$(tput sgr0)\]\[\033[38;5;14m\]\t\[$(tput sgr0)\]\[\033[38;5;15m\]]═[\[$(tput sgr0)\]\[\033[38;5;14m\]\u@\h\[$(tput sgr0)\]\[\033[38;5;15m\]]═[\[\033[38;5;14m\]\w\[$(tput sgr0)\]]\n╚═╡ \[$(tput sgr0)\]" | |
} | |
PROMPT_COMMAND=set_bash_prompt |
Author
sirolf2009
commented
Aug 12, 2017
Pulling the BTC price has been moved to cron, to reduce the prompt loading time
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment