Created
March 1, 2020 11:48
-
-
Save Cryptiiiic/a60e205c1f2e92ffc438152f385e7ef6 to your computer and use it in GitHub Desktop.
JelbrekICU Mac Screenshot upload script.
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
#!/bin/bash | |
if [ "$(defaults read com.apple.screencapture location)" != "~/Screenshots" ]; then | |
defaults write com.apple.screencapture location "\~/Screenshots" | |
fi | |
if [[ -f "/usr/local/bin/jq" ]]; then | |
cd ~/Screenshots | |
name=jelbrek_icu.png | |
touch ./.screenshot_watch | |
while true | |
do | |
sleep 0.2 | |
find . ! -name ./.screenshot_watch ! -name ./Trash ! -name ./jelbrek_icu.png -type f -cnewer ./.screenshot_watch -exec bash -c "mv \"{}\" $name && curl -s -H'authorization: $1' -F'x=@'$name https://jelbrek.icu/upload | jq -r '.url' | tr -d '\n' | pbcopy; echo -n Uploaded-; pbpaste | xargs echo -n | rev | cut -d '/' -f 1 | rev | xargs echo -n; echo -n -; date +'%Y%m%d%H%M%S'; touch ./.screenshot_watch" \; | |
done | |
else | |
brew install jq | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment