Compare commits

...

5 Commits

6 changed files with 70 additions and 8 deletions

19
bin/lmount Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
if [ "$#" -ne 2 ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program expects two arguments\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lmount <drive> <mount point>"
exit 1
fi
if [ "$USER" != "root" ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program must be run as root\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lmount <drive> <mount point>"
exit 1
fi
# Mounts an encrypt external drive to a specified mount point
cryptsetup luksOpen $1 external
mount /dev/mapper/external $2

19
bin/lumount Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program expects one argument\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lumount <mount point>"
exit 1
fi
if [ "$USER" != "root" ]; then
echo -e >&2 "\x1B[1;31merror:\x1B[0;1m this program must be run as root\x1B[0m"
echo -e >&2 "\x1B[1;33musage:\x1B[0;1m sudo lumount <mount point>"
exit 1
fi
# Mounts an encrypt external drive to a specified mount point
umount $1
cryptsetup luksClose external

View File

@ -14,23 +14,34 @@ _check_date() {
fi
}
main() {
if [ "$1" == "startup" ]; then
_check_date
if [ $? -ne 0 ]; then
curl --retry 10 --connect-timeout 20 wttr.in 2>/dev/null
weather_loop() {
if [ $# -gt 0 ]
then
for ((i=1; i<=$#; i++)); do
curl --retry 10 --connect-timeout 20 wttr.in/${!i} 2>/dev/null
done
if [ $? -eq 0 ]; then
date +%d/%m/%Y > ~/.config/dotfiles/.data/weather_date
else
echo -e "\033[31;1mNetwork unavailable, please check your connexion or try again later.\033[0m"
fi
fi
else
curl --retry 10 --connect-timeout 20 wttr.in 2>/dev/null
if [ $? -ne 0 ]; then
if [ $? -eq 0 ]; then
echo -e "\033[31;1mNetwork unavailable, please check your connexion or try again later.\033[0m"
fi
fi
}
main() {
if [ "$1" == "startup" ]; then
_check_date
if [ $? -ne 0 ]; then
weather_loop ${@:2}
fi
else
weather_loop $@
fi
}
main $@

View File

@ -45,6 +45,7 @@ set expandtab
set tabstop=4
set shiftwidth=4
set autoindent
set tw=120
" }}}
" UI CONFIG #########################################################{{{

View File

@ -51,11 +51,23 @@ alias bat="bat --paging=never"
alias rg="rg -uu"
# Aliases for pass
alias p="pass"
alias pc="pass --clip"
# mkdir && cd
mkcd() {
mkdir $1 && cd $1
}
# which && cd
cdw() {
f=`which $1`
if [ $? -eq 0 ]; then
cd `dirname $f`
fi
}
# Initialize thefuck
command -v thefuck > /dev/null 2>&1

View File

@ -20,7 +20,7 @@ DISABLE_AUTO_TITLE="true"
# Which plugins would you like to load? (plugins can be found in ~/.oh-my-zsh/plugins/*)
# Custom plugins may be added to ~/.oh-my-zsh/custom/plugins/me
# Example format: plugins=(rails git textmate ruby lighthouse)
plugins=(git myjump)
plugins=(git myjump pass)
source $ZSH/oh-my-zsh.sh