Compare commits

...
10 Commits
Author SHA1 Message Date
justin 69f76dd54e Update README.md 2023-09-29 11:13:41 -07:00
justin 276a6223a3 Upload bash script crex.sh
Query domain name creation and expiration dates.
2023-09-29 11:09:12 -07:00
justin 92d9e3fa1a Update rotate.sh 2023-07-24 13:52:10 -07:00
justin 526efc2255 Update README.md 2023-07-17 11:06:38 -07:00
justin d81053d31c Query UofA employee payroll data via CLI 2023-07-17 07:42:30 -07:00
justin 2d965f8f2c Update README.md 2023-07-12 06:53:02 -07:00
justin 62c0060617 Update README.md 2023-07-12 06:51:49 -07:00
justin 0c798d9dc7 Update README.md 2023-07-11 15:46:46 -07:00
justin ff6ee95815 Added support for middle name
Added support for more than FirstName LastName (e.g. John William Smith)
2023-07-09 19:31:26 -07:00
justin 2d5302f56d Query UA Pay by Name
Usage: uapay.sh FirstName LastName
2023-07-09 14:23:32 -07:00
4 changed files with 94 additions and 31 deletions

No files matched your search

+11 -2
View File
@@ -1,2 +1,11 @@
# bash_scripts
A collection of Bash Scripts
### diffweb.sh
`Checks a website for changes.`
### rotate.sh
`Rotate a screen in Linux.`
### uapay.sh
`A command-line interface to UofA employee payroll data.`
### crex.sh
`Query a domain name's creation date and expiration date.`
+50
View File
@@ -0,0 +1,50 @@
#!/bin/bash
# Description: Query Domain Name Creation and Expiration dates.
# Usage: crex.sh <domain.tld>
# Author: Justin Oros
# Source: https://github.com/JustinOros
# Dependency Checks
TARGET_FILE='/usr/bin/whois'
if [ ! -f "$TARGET_FILE" ]
then
echo "$TARGET_FILE does not exist."
exit
fi
TARGET_FILE='/usr/bin/grep'
if [ ! -f "$TARGET_FILE" ]
then
echo "$TARGET_FILE does not exist."
exit
fi
TARGET_FILE='/usr/bin/awk'
if [ ! -f "$TARGET_FILE" ]
then
echo "$TARGET_FILE does not exist."
exit
fi
TARGET_FILE='/usr/bin/head'
if [ ! -f "$TARGET_FILE" ]
then
echo "$TARGET_FILE does not exist."
exit
fi
# User Input
DOMAIN_NAME=$1
# Get Creation Date
CREATION_DATE=$(whois $DOMAIN_NAME | grep 'Creation' | awk '{print $3;}' | head -n 1)
# Get Expiration Date
EXPIRATION_DATE=$(whois $DOMAIN_NAME | grep 'Expiration' | awk '{print $5;}')
# Output Results
echo '-'
echo 'Domain:' $DOMAIN_NAME
echo 'Creation:' $CREATION_DATE
echo 'Expiration:' $EXPIRATION_DATE
echo '-'
+5 -4
View File
@@ -1,7 +1,8 @@
#!/bin/bash
# rotate all screens clockwise in a complete circle
# by Justin Oros
# Description: Rotate screen clockwise in a complete circle
# Usage: rotate.sh
# Author: Justin Oros
# Source: https://github.com/JustinOros
screen_types="VGA HDMI DP eDP"
screen_rotations="right inverted left normal"
@@ -18,7 +19,7 @@ rotate() {
do
for screen in 0 .. $screens
do
xrandr --output $screen_type-$screen --rotate $screen_rotation > /dev/null 2>&1
xrandr -o $screen_rotation > /dev/null 2>&1
done
done
sleep $sleep_time
+28 -25
View File
@@ -1,59 +1,62 @@
#!/bin/bash
#################################################
# Query Univeristy of Arizona payroll information
# Written by Justin Oros
# Usage: uapay.sh FirstName LastName
#################################################
# Description: Query UofA employee payroll data via CLI
# Usage: uapay.sh <first name> <last name>
# Author: Justin Oros
# Source: https://github.com/JustinOros
# Check to see if BASH is installed
{
# BASH present?
if [ ! -f /bin/bash ]; then
echo "Bash not found!"
exit 0
fi
}
# Check to see if CURL is installed
{
# CURL present?
if [ ! -f /usr/bin/curl ]; then
echo "Curl not found!"
exit 0
fi
}
# Check to see if GREP is intalled
{
# GREP present?
if [ ! -f /usr/bin/grep ]; then
echo "Grep not found!"
exit 0
fi
}
# URL for UA Salaries
# UA Payroll URL
uapay_url='https://openpayrolls.com/employee'
# User Agent
uapay_useragent='Chrome/79'
# Get Input from User
{
# Get Input
if [ -z "$1" ] || [ -z "$2" ]; then
echo -e "\nUsage: uapay.sh FirstName LastName\n"
exit 0
else
uapay_name=$1-$2
for i in "$@"
do
uapay_name="$@"
done
fi
}
# Format Input
uapay_formatted_name=${uapay_name// /-}-4329
# Grep Filter
uapay_filter="and a pay of"
# Query URL
uapay_output=$(curl -s -k --user-agent $uapay_useragent $uapay_url/$uapay_name-4329 | grep "$uapay_filter")
uapay_query=$(curl -s -k --user-agent $uapay_useragent $uapay_url/$uapay_formatted_name | grep "$uapay_filter")
# Format output
#echo ${uapay_output/<\/p>/}
uapay_output=${uapay_output/\<p class=\"lead font-16 font-weight-400\"\>/}
uapay_output=${uapay_output/\<\/p\>/}
# Check Results
if [ -z "$uapay_query" ]; then
echo -e "\n$uapay_name was not found.\n"
exit 0
fi
echo -e "\n$uapay_output\n"
# Format Output
uapay_query=${uapay_query/\<p class=\"lead font-16 font-weight-400\"\>/}
uapay_query=${uapay_query/\<\/p\>/}
# Print Output
echo -e "\n$uapay_query\n"