-
-
Save beNjiox/8350acdf2fae6ab6bdc3dbf1a7bc6734 to your computer and use it in GitHub Desktop.
Scripts that work as is on a remote debug Heroku CI console (to extract screenshots, logs, etc.)
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/sh | |
# Install: | |
# curl https://gist.githubusercontent.com/gingerbeardman/a7737e4c89fccab8605f8538ddaeec0d/raw/a78f5253b0fcdbd7b893f91627a29498690356ea/file.io.sh | tee file.io && chmod +x file.io | |
URL="https://file.io" | |
DEFAULT_EXPIRE="14d" # Default to 14 days | |
if [ $# -eq 0 ]; then | |
echo "Usage: file.io FILE [DURATION]\n" | |
echo "Example: file.io path/to/my/file 1w\n" | |
exit 1 | |
fi | |
FILE=$1 | |
EXPIRE=${2:-$DEFAULT_EXPIRE} | |
if [ ! -f "$FILE" ]; then | |
echo "File ${FILE} not found" | |
exit 1 | |
fi | |
RESPONSE=$(curl -# -F "file=@${FILE}" "${URL}/?expires=${EXPIRE}") | |
RETURN=$(echo "$RESPONSE" | php -r 'echo json_decode(fgets(STDIN))->success;') | |
if [ "1" != "$RETURN" ]; then | |
echo "An error occured!\nResponse: ${RESPONSE}" | |
exit 1 | |
fi | |
KEY=$(echo "$RESPONSE" | php -r 'echo json_decode(fgets(STDIN))->key;') | |
EXPIRY=$(echo "${RESPONSE}" | php -r 'echo json_decode(fgets(STDIN))->link;') | |
echo "${URL}/${KEY}" # to terminal |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment