[ -z "$PS1" ] && return
if [ $(tty) == "/dev/tty1" ]; then
exec startx
fi
HISTCONTROL=erasedups:ignorespace:ignoredups
HISTFILE="$HOME/.cache/bash_history"
HISTFILESIZE=9000
HISTSIZE=$( expr $HISTFILESIZE + 2000 )
export CFLAGS=' -pedantic -Wall '
export CXXFLAGS="$CFLAGS"
set_color() {
case $1 in
"normal")
printf "\e[0m"; shift; set_color $*; return; ;;
"bold")
printf "\e[1m"; shift; set_color $*; return; ;;
"blink")
printf "\e[5m"; shift; set_color $*; return; ;;
"rev")
printf "\e[7m"; shift; set_color $*; return; ;;
"f")
t="3"; shift ;;
"b")
t="4"; shift ;;
*)
t="3"; ;;
esac
case $1 in
"black")
printf "\e[%d0m" $t; shift; set_color $*; ;;
"red")
printf "\e[%d1m" $t; shift; set_color $*; ;;
"green")
printf "\e[%d2m" $t; shift; set_color $*; ;;
"yellow")
printf "\e[%d3m" $t; shift; set_color $*; ;;
"blue")
printf "\e[%d4m" $t; shift; set_color $*; ;;
"magenta")
printf "\e[%d5m" $t; shift; set_color $*; ;;
"cyan")
printf "\e[%d6m" $t; shift; set_color $*; ;;
"white")
printf "\e[%d7m" $t; shift; set_color $*; ;;
"default")
printf "\e[%d9m" $t; shift; set_color $*; ;;
esac
}
nhost=$( echo $HOSTNAME | md5sum | cut -d ' ' -f 1| tr a-z A-Z | bc)
nhost=$(echo $nhost "% 6 + 1" | bc)
CH=$(printf "\e[3%dm" $nhost)
fPS1(){
res=$?
if [ $res -eq 0 ]; then
res=":)"
else
res=":("
fi
date=$(date +"%H:%M")
dir=$(pwd | sed -e 's|^'$HOME'|~|')
njobs=$(jobs -p | wc -l)
if [ $(whoami) == "root" ]; then
set_color b blue f red blink
printf "[ROOT]"
set_color normal
fi
set_color b blue f cyan
printf "${res}"
set_color f blue b cyan
printf "${date}┃${njobs}"
set_color b black f cyan
printf "$CH${HOSTNAME}"
set_color f black b cyan
printf "${dir}"
set_color f cyan b black
printf ""
set_color normal
printf "\n~> "
}
N=$(set_color normal)
BL=$(set_color blink)
R=$(set_color red bold)
W=$(set_color white bold)
G=$(set_color green bold)
fPS2(){
date=$(date +"%H:%M")
dir=$(pwd | sed -e 's|^'$HOME'|~|')
njobs=$(jobs -p | wc -l)
nhist=$(history | wc -l)
sufix="~> "
if [ $(whoami) == "root" ]; then
rootM="$BL$R[ROOT]$N"
fi
printf "${rootM}"
printf "${G}("
printf "${W}${nhist}"
printf "${G})-("
printf "${W}${date}|${njobs}${G}"
printf "${G})-("
printf "${CH}${HOSTNAME}${W}|${dir}${G}"
printf ")$N\n"
printf "$sufix"
}
fPS3(){
res=$?
if [ $res -eq 0 ]; then
res="^_^"
else
res="T_T"
fi
date=$(date +"%H:%M")
dir=$(pwd | sed -e 's|^'$HOME'|~|')
njobs=$(jobs -p | wc -l)
if [ $(whoami) == "root" ]; then
set_color f red blink
printf "[ROOT☭]"
set_color normal
fi
set_color bold f green
printf "("
set_color f white
printf "${res}"
set_color f green
printf ")~("
set_color f white
printf "${date}"
set_color f green
printf "|"
set_color f white
printf "${njobs}"
set_color f green
printf "|"
set_color f white
printf "$CH${HOSTNAME}"
set_color f green
printf ")"
set_color f white
printf "${dir}"
set_color f green
printf ">"
set_color normal
printf "\n~> "
}
PS1='$(fPS3)'
alias ls='ls --color=auto --time-style=posix-long-iso'
alias grep='grep --color=auto'
eval $(dircolors)
alias ll='ls -l -h'
alias la='ls -a'
export LESS="-j2 -R -i"
alias deltmp='rm -fr *~'
ntharg() {
shift $1
printf '%s\n' "$1"
}
rm(){
if [ "$(ntharg $# "$@")" = '-rf' ]; then
echo "Don't put '-rf' at the end!!"
return 1
else
/bin/rm -i "$@"
fi
}
alias mv='mv --interactive'
alias cp='cp --interactive'
alias rr='trash-put'
alias rr-put='trash-put'
alias rr-list='trash-list'
alias rr-rm='trash-rm'
alias rr-empty='trash-empty'
alias rr-restore='trash-restore'
alias sudo='sudo -E'
alias mpv='mpv --no-audio-display'
alias yt='mpv --ytdl-format="bestvideo[height<=480]+bestaudio"'
alias mpvnv='mpv --ytdl-format="bestaudio" --no-video'
alias clima='curl -s "http://wttr.in/neuquen,neuquen?Q&2"'
bind '"\eOA":history-search-backward'
bind '"\eOB":history-search-forward'
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'
bind '"\C-e":"\e[4~ &>/dev/null & disown $!"'
echo "GLaDOS 0.7.1b @ $HOSTNAME"
todo(){
TODOFILE=$HOME/todo.txt
if [ -e $TODOFILE ]; then
TODOFILE_CONT=$(cat $TODOFILE | grep -v -e '^#' -e '^$')
if [ $(echo "$TODOFILE_CONT" | wc -l) != '1' ]; then
echo "$TODOFILE_CONT" | /usr/games/cowsay -n
else
#/usr/games/fortune | /usr/games/cowsay -n
true
fi
fi
}
[ $(expr $RANDOM % 20) -eq '0' ] && todo | lolcat
export QUOTING_STYLE=literal
dance(){
printf "(>'-')> "
sleep 0.5
printf "\r<('-'<) "
sleep 0.5
printf "\r^(' - ')^"
sleep 0.5
printf "\r<('-'<) "
sleep 0.5
printf "\r\n"
}
waitN(){
[ $# -lt 1 ] && return 0;
while [ $(jobs |wc -l) -gt $1 ]; do
sleep 1;
done
}
clearHist(){
(
set -o pipefail
tmpfile=$(mktemp)
tac "$HISTFILE" | sed 's-^[\t ]*--;s-[\t ]*$--g' |
awk '(!x[$0]++){print $0}' | tac > $tmpfile &&
mv -f $tmpfile "$HISTFILE"
)
}
[ $(expr $RANDOM % 20) -eq '0' ] && clearHist
wide() {
echo "$*" | toilet -f wideterm
}
true
application/octet-stream
This content has been proxied by September (ba2dc).