function up2frank

This commit is contained in:
Frank Villaro-Dixon 2013-10-22 23:13:38 +02:00
parent 20b3a07098
commit 3bfe3a14c1

62
bashrc
View file

@ -163,9 +163,8 @@ alias im='profanity'
## FONCTIONS ##
###############
# {{{
function cd()
function cd #{{{
{
# {{{
if [ $# -eq 0 ]; then
builtin cd ~ && ls
else
@ -175,44 +174,43 @@ function cd()
#}}}
alias ssh='my_ssh'
function my_ssh
{ # {{{
function my_ssh #{{{
{
ssh-add -l | grep id_rsa.auth > /dev/null
if [ $? -eq 1 ]; then
echo -e "$RED Please enter ssh passphrase ;) $DFT"
ssh-add ~/.ssh/id_rsa.auth
fi;
"/usr/bin/ssh" $*
/usr/bin/ssh "$@"
}
# }}}
alias scp='my_scp'
function my_scp
{ # {{{
function my_scp #{{{
{
ssh-add -l | grep id_rsa.auth > /dev/null
if [ $? -eq 1 ]; then
echo -e "$RED Please enter ssh passphrase ;) $DFT"
ssh-add ~/.ssh/id_rsa.auth
fi;
"/usr/bin/scp" $*
/usr/bin/scp "$@"
}
# }}}
function logs
{ # {{{
function logs #{{{
{
tail -f $1 | ccze -A
}
# }}}
} # }}}
function mkcd()
{ # {{{
function mkcd #{{{
{
mkdir -p "$@"
cd "$@"
}
# }}}
extract()
{ # {{{
function extract #{{{
{
local e=0 i c
for i; do
if [ -f $i && -r $i ]; then
@ -242,7 +240,7 @@ extract()
}
# }}}
function study()
function study #{{{
{
if [ -z $1 ]; then
STUDY_PATH=''
@ -261,7 +259,7 @@ function study()
echo -e "$DFT"
fi
ls
}
} #}}}
_StudyCompletion()
{ # {{{
@ -291,7 +289,7 @@ complete -F _StudyCompletion -o filenames study
## FIXME TO IMPROVE WITH VARIOUS locations (ex: ro 1; ro 2; ro 3)
RO_ROOT_DIRECTORY=/dev/shm/ro_$USER
function ro()
ro()
{ # {{{
if [ ! -d $RO_ROOT_DIRECTORY ]; then
mkdir $RO_ROOT_DIRECTORY
@ -314,7 +312,7 @@ function ro()
fi;
} # }}}
function roset()
roset()
{ # {{{
if [ ! -d $RO_ROOT_DIRECTORY ]; then
mkdir $RO_ROOT_DIRECTORY
@ -354,20 +352,20 @@ _RoRosetCompletion()
} # }}}
complete -F _RoRosetCompletion -o filenames ro roset
function calc()
function calc #{{{
{
echo "scale=3;$@" | bc -l
}
} #}}}
function xournal() {
function xournal { #{{{
if [ -e "$1".xoj ]; then
/usr/bin/xournal "$1".xoj
else
/usr/bin/xournal "$1"
fi
}
} #}}}
function mutt() {
function mutt { #{{{
if [ $# -eq 0 ]; then
if [ "$(pidof mutt)" ]; then
/usr/bin/mutt -R
@ -377,7 +375,18 @@ function mutt() {
else
/usr/bin/mutt $@
fi;
}
} #}}}
up2frank() { #{{{
if [ ! $# -eq 1 ]; then
echo "usage: up2frank FILE"
return
else
file=$(echo $1 | sed 's/ /_/g')
scp "$1" "frank@vi-di.fr:public_html/upload/$file" > /dev/null
echo "https://frank.villaro-dixon.eu/upload/$file"
fi;
} #}}}
# }}}
@ -409,6 +418,7 @@ export MANPATH=$MANPATH:$DEVKITARM/man
export PATH=$PATH:~/Programmation/dotfiles/Utils
# }}}
export PATH="$HOME/opt/cross/bin:$PATH"
#Launch startx when login
[[ -z $DISPLAY && $XDG_VTNR -le 4 && -z $SSH_CLIENT ]] && exec startx