# # _ ____ _ _ # __| |___ \ __ _(_)_ __ _______| |__ # / _` | __) / _` | | '__|_ / __| '_ \ # | (_| |/ __/ (_| | | | _ / /\__ \ | | | # \__,_|_____\__,_|_|_|(_)___|___/_| |_| # # bindkey "${key[Up]}" up-line-or-history bindkey "${key[Down]}" down-line-or-history bindkey "${key[PageUp]}" history-beginning-search-backward bindkey "${key[PageDown]}" history-beginning-search-forward # # Alias # alias cdiff='colordiff -u' alias cdir='dir --color=always' alias weather="curl http://wttr.in/paris" alias meteo="curl http://wttr.in/paris" alias meteoparis="curl http://wttr.in/paris" alias code="< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c32" alias code8="apg -a 0 -M sncl -n 4 -x 8 -m 8" alias code16="apg -a 0 -M sncl -n 6 -x 16 -m 16" alias code32="apg -a 0 -M sncl -n 8 -x 32 -m 32" alias aptup="sudo apt update && sudo apt upgrade && sudo apt dist-upgrade && sudo rkhunter --propupd" # # Functions # transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } # # Banner # whoami | figlet -f smslant ippub=`curl -s http://checkip.amazonaws.com/` iplan=`ip route get 8.8.8.8 | awk -F"src " 'NR==1{split($2,a," ");print a[1]}'` echo "Adresse IP $ippub ($iplan)" unset ippub iplan if [ ${#plugins[@]} -gt 1 ]; then echo "${#plugins[@]} plugins oh-my-zsh sont activés."; elif [ ${#plugins[@]} -eq 1 ]; then echo "Le plugin \e[1m${plugins[1]} \e[0md'oh-my-zsh est activé."; else echo "Aucun plugin oh-my-zsh ne fut activé"; fi nb_alias=`alias | wc -l` if [ $nb_alias -gt 1 ]; then echo "$nb_alias alias sont définis."; elif [ $nb_alias -eq 1 ]; then echo "Un alias est défini."; else echo "Aucun alias n'est défini"; fi unset nb_alias echo "L'entropie est de $(cat /proc/sys/kernel/random/entropy_avail)/$(cat /proc/sys/kernel/random/poolsize)"