Skip to content

Instantly share code, notes, and snippets.

@alexcu
Last active March 27, 2019 04:31
Show Gist options
  • Save alexcu/cd4babc16d7fe9f90f6e5c43cac41fff to your computer and use it in GitHub Desktop.
Save alexcu/cd4babc16d7fe9f90f6e5c43cac41fff to your computer and use it in GitHub Desktop.
Bitly link generator for macOS
#/usr/bin/env bash
# Refer to http://bit.ly/2TF7FU8 on how to find your Bearer and Group GUID
link=$(curl -s -X POST \
https://api-ssl.bitly.com/v4/bitlinks \
-H 'Authorization: Bearer XXXXXXXX' \
-H 'Content-Type: application/json' \
-d "{
\"group_guid\": \"XXXXXXXX\",
\"long_url\": \"$1\"
}" | sed -E "s/^.+link\":\"([^\"]+).+$/\1/")
echo $link | pbcopy
echo $link has been copied to the keyboard
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment