Skip to content

Instantly share code, notes, and snippets.

@fooqri
Created December 17, 2012 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fooqri/4321473 to your computer and use it in GitHub Desktop.
Save fooqri/4321473 to your computer and use it in GitHub Desktop.
TextExpander snippet for saving clipboard image to disk and writing markdown link for it.
#!/usr/bin/env bash
uuid_str=$(/usr/local/bin/uuid)
dir="/Users/my-account/my-wiki/images/"
target="$dir$uuid_str.png"
var=$(/usr/local/bin/pngpaste $target 2>&1)
if [ "$var" == "No PNG data found on the clipboard!" ];
then
echo "No-PNG"
else
echo "[![$uuid_str.png](images/$uuid_str.png)](images/$uuid_str.png)"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment