This commit is contained in:
Frank Villaro-Dixon 2013-11-07 15:51:53 +01:00
parent 8c74209486
commit 623cb85fde

51
bashrc
View file

@ -30,6 +30,8 @@ man() {
#####ON DEFINIT LES COULEURS
red='\033[31m'
RED='\033[31m\033[01m'
YELLOW='\033[33m'
GREEN='\033[32m'
blue='\033[34m'
BLUE='\033[34m'
cyan='\033[36m'
@ -396,7 +398,56 @@ function rfc
} #}}}
function tobed
{ #{{{
if [ $? -eq 0 ]; then #want to sleep now
tstmp=`date +%s`
tstmp=$(($tstmp+1000)) #16 min to fall asleep
tomorrow=$(($tstmp + 82800))
cycles=0;
one_cycle=5580 #93 min
while true; do
tstmp=$(($tstmp + $one_cycle))
((cycles++))
hour=`echo $tstmp | date --date=@$tstmp +%-H`
if [[ $hour -gt 4 && $hour -lt 12 ]]; then
min=`echo $tstmp | date --date=@$tstmp +%M`
stime=`echo "scale=1; $one_cycle * $cycles / 3600" | bc`
if [ $cycles -lt 5 ]; then #Not quite right: btw 7 and 9 hours -> 5/6 cycles
echo -ne $RED
elif [ $cycles -lt 6 ]; then
echo -ne $YELLOW
else
echo -ne $GREEN
fi
echo -e "$cycles cycles ($stime h)\t\tGet up: [$hour:$min]"
echo -ne $DFT
fi
if [[ $tstmp -gt $tomorrow && $cycles -gt 6 ]]; then
break;
fi
done;
fi
} #}}}
function bpm
{
read n
start=`date +%s`
beats=0
while true; do
read n
((beats++))
actual=`date +%s`
diff=`echo "scale=1; $beats / (($actual - $start) / 60)" | bc`
echo $diff bpm
done
}
# }}}
SSHAGENT=/usr/bin/ssh-agent