Skip to content

Instantly share code, notes, and snippets.

@tlrobinson
Created March 14, 2016 21:59
Show Gist options
  • Save tlrobinson/e362b8397d1042997fd4 to your computer and use it in GitHub Desktop.
Save tlrobinson/e362b8397d1042997fd4 to your computer and use it in GitHub Desktop.
Command-line Giphy using iTerm2's imgcat (also requires curl and jq)
#!/bin/sh
tag="$(echo "$*" | sed 's/ /+/')"
random_api_url="http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=$tag"
gif_url="$(curl "$random_api_url" 2> /dev/null | jq '.data.image_url' -r)"
curl "$gif_url" 2> /dev/null | imgcat
@tlrobinson
Copy link
Author

z5mnfm9z65

@lacostenycoder
Copy link

For some reason I get imgcat: command not found but you can clearly see it's installed and working if I call it directly from the command line. I tried both bash and zsh. Any ideas? Thanks!

screen shot 2017-04-07 at 4 27 48 pm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment