Last active
August 10, 2020 20:15
-
-
Save gelosi/2e87c89d339e177fde64d2a0ca6db551 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DISCLAMER: straightforward, might break any time xD | |
# this will strip html and will sort strings, so, you will see same model data next to each other | |
search_year=`date +%Y` | |
search_model="" #any model | |
search_model_message="any model" | |
if [ -n "$1" ]; then | |
echo "YEAR supplied: $1" | |
search_year="$1" | |
fi | |
if [ -n "$2" ]; then | |
search_model="$2" | |
search_model_message="$2" | |
fi | |
# yes, it's straighforward, we support maximum 2 pieces in the name | |
# if there will be a MacBook Pro Air – well, we can use "Pro Air" to find it | |
if [ -n "$3" ]; then | |
search_model="$2 $3" | |
search_model_message="$search_model" | |
fi | |
echo "looking into $search_model_message for year $search_year" "\n" | |
# the pipe will strip html line by line till we get something like | |
# | |
curl -sS https://browser.geekbench.com/mac-benchmarks/ \ | |
| grep -i -A 8 "$search_model.*\(.*\s$search_year\)" \ | |
| sed -e "s/\<.*\>/ /g" \ | |
| tr -d "\n" \ | |
| sed -e "s/\-\-/±/g" \ | |
| tr '±' '\n' \ | |
| sort \ | |
| grep -v "^$" | |
echo | |
echo "possible parameters (stupid positional): $0 YEAR MODEL" | |
echo "example: $0 2018 MacBook Pro" | |
echo "tip: model ignoring year – use a part of the year string: $0 20 MacBook Air" | |
echo "pro tip: you can grep the output of this script =^^=" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment