├── README.md ├── dahi ├── dod.sh ├── need-dahi.sh └── checkdahi.sh /README.md: -------------------------------------------------------------------------------- 1 | # dahiutils 2 | because dahi makes the coreutils even better 3 | -------------------------------------------------------------------------------- /dahi: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # `dahi` directly maps to the sudo command 4 | # Now you can do `dahi yum install [whatever]` 5 | 6 | sudo ${@:1} 7 | 8 | -------------------------------------------------------------------------------- /dod.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # DOD - Dahi of the Day 4 | # @author Vaibhav Mehta 5 | # @copyright Copyright (c) 2016 Vaibhav Mehta 6 | # @license http://www.opensource.org/licenses/mit-license.html MIT License 7 | 8 | # Output Colors 9 | GREEN="\033[0;32m" 10 | NC="\033[0m" 11 | 12 | # List of Dahi brands 13 | brands=("Mother Dairy" "Amul" "Epigamia" "Nestle" "Britannia" "Govardhan") 14 | rand=$[$RANDOM % 6] 15 | 16 | # DOD 17 | echo "Dahi of the day is ${GREEN}${brands[$rand]}${NC}. Stay healthy!" 18 | -------------------------------------------------------------------------------- /need-dahi.sh: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | 3 | echo "_______ " 4 | echo "\ ___ \`'. . .--. " 5 | echo " ' |--.\ \ .'| |__| " 6 | echo " | | \ ' < | .--. " 7 | echo " | | | ' __ | | | | " 8 | echo " | | | | .:--.'. | | .'''-. | | " 9 | echo " | | ' .'/ | \ | | |/.'''. \| | " 10 | echo " | |___.' /' \`\" __ | | | / | || | " 11 | echo "/_______.'/ .'.''| | | | | ||__| " 12 | echo "\_______|/ / / | |_| | | | " 13 | echo " \ \._,\ '/| '. | '. " 14 | echo " \`--' \`\" '---' '---' " 15 | -------------------------------------------------------------------------------- /checkdahi.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # @author Vaibhav Mehta 4 | # @copyright Copyright (c) 2016 Vaibhav Mehta 5 | # @license http://www.opensource.org/licenses/mit-license.html MIT License 6 | 7 | # Output Colors 8 | RED="\033[0;31m" 9 | GREEN="\033[0;32m" 10 | NC="\033[0m" 11 | 12 | 13 | # Expiration in n days 14 | amulexpiresin=15 15 | epigamiaexpiresin=14 16 | 17 | currentdate=$(date +"%Y-%m-%d") 18 | 19 | # Ask for brand 20 | echo "Select Dahi Brand: ${RED}Amul${NC} / ${RED}Epigamia${NC}" 21 | read brand 22 | 23 | # Validate Brand 24 | if [[ "$brand" -ne "Amul" || "$brand" -ne "Epigamia" ]] ; 25 | then 26 | echo "No expiration check for ${brand}" 27 | exit 1 28 | fi 29 | 30 | # Ask for Manufacturing Date 31 | echo "Enter Dahi Manufacturing Date : ${RED}(YYYY-MM-DD)${NC}" 32 | read manufacturingdate 33 | 34 | # Manufacturing Date + Expires In 35 | # Thanks to @anirudha13 36 | amulexpirydate=$(date -j -f %Y-%m-%d -v+${amulexpiresin}d $manufacturingdate +"%Y-%m-%d") 37 | epigamiaexpirydate=$(date -j -f %Y-%m-%d -v+${epigamiaexpiresin}d $manufacturingdate +"%Y-%m-%d") 38 | 39 | # Decide date to check (Includes expires in) 40 | if [[ $brand == "Amul" ]] ; 41 | then 42 | checkexpiryfor=$amulexpirydate 43 | elif [[ $brand == "Epigamia" ]] ; 44 | then 45 | checkexpiryfor=$epigamiaexpirydate 46 | fi 47 | 48 | # Check for Expiry 49 | if [[ $checkexpiryfor < $currentdate ]] ; 50 | then 51 | echo "${RED}Your ${brand} dahi is expired, blame your office (Script for blaming[Coming Soon])${NC}" 52 | else 53 | echo "${GREEN}Your ${brand} dahi isn't expired, you can go to office :)${NC}" 54 | fi --------------------------------------------------------------------------------