Created
November 16, 2012 16:03
-
-
Save q0rban/4088499 to your computer and use it in GitHub Desktop.
Monosnap/Github Shell 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
#!/usr/bin/env sh | |
# https://gist.github.com/4088499 | |
FIND="^monosnap.com\/image\/\([a-zA-Z0-9]*\)" | |
REPLACE="![](https:\/\/api.monosnap.com\/image\/download\?id=\1)" | |
pbpaste | | |
# Different versions of monosnap have this formatted differently, so we grep | |
# first for just what we need. | |
grep -o monosnap.com/image/[a-zA-Z0-9]* | | |
# Grab the current cliboard contents and do our replacement. | |
sed -n "s/$FIND/$REPLACE/p" | | |
# Trim off any trailing new lines that sed might add. | |
tr -d '\n' | | |
# Put it back in the clipboard. | |
pbcopy |
REPLACE="![img](https:\/\/api.monosnap.com\/image\/download\?id=\1)"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's how I have it set up in Alfred: