Last active
November 8, 2017 06:34
-
-
Save cmcculloh/11432852 to your computer and use it in GitHub Desktop.
Takes contents of clipboard, syntax highlights them, pasts them into a gist, opens the gist in a browser, and puts syntax highlighted version of text in clipboard for pasting into Evernote/email/etc
This file contains hidden or 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/bash | |
# Takes contents of clipboard, syntax highlights them, places a copy in "gists" directory in Google Drive, pastes them into a gist, opens the gist in a browser, and puts syntax highlighted version of text in clipboard for pasting into Evernote/email/etc | |
# requires: | |
#* gist (https://github.com/defunkt/gist) | |
#* Google Drive | |
#* highlight (brew install highlight) | |
#* an alias that will run this file `alias gst="~/gst.sh"` | |
# Call like: | |
# gst gistname.ext "gist description" | |
echo "creating $1 at:" | |
gist -P -o -f $1 -d "$2" | |
touch "/Users/cmcculloh/Google Drive/gists/$1" | |
pbpaste > "/Users/cmcculloh/Google Drive/gists/$1" | |
extension="${1##*.}" | |
highlight -O rtf -t 2 -K 11 -k 'Source Code Pro' --syntax $extension "/Users/cmcculloh/Google Drive/gists/$1" | pbcopy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment