-
-
Save brandonb927/5283527 to your computer and use it in GitHub Desktop.
Revisions
-
Brandon Brown revised this gist
May 1, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ <key>Label</key> <string>com.user.evernote_markdown</string> <key>Program</key> <string>/path/to/evernote_selection.sh</string> <key>RunAtLoad</key> <true/> </dict> -
Brandon Brown revised this gist
Apr 4, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -28,10 +28,10 @@ Create the script file then paste the contents of [evernote_selection.py](https: $ [sudo] touch evernote_selection.py #### Step 4) #### Create a file called [com.user.evernote_markdown.plist](https://gist.github.com/brandonb927/5283527#file-com-user-evernote_markdown-plist) in `~/Library/LaunchAgents` #### Step 5) #### Create the script [evernote_selection.sh](https://gist.github.com/brandonb927/5283527#file-evernote_selection-sh) that will run on boot anywhere on your computer, but remember to reference it in `com.user.evernote_markdown.plist` #### Step 6) #### Add the executable bit to the file with -
Brandon Brown revised this gist
Apr 4, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -23,7 +23,7 @@ Create the file `EvernoteSelection.md` in ~/Documents or wherever you want this It is essentially a cache file and contains only the information of your Evernote when you hit save. #### Step 3) #### Create the script file then paste the contents of [evernote_selection.py](https://gist.github.com/brandonb927/5283527#file-evernote_selection-py) into it $ [sudo] touch evernote_selection.py -
Brandon Brown revised this gist
Apr 4, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,7 @@ Create the script file then paste the contents of the Python script into evernot Create a file called `com.user.evernote_markdown.plist` in `~/Library/LaunchAgents` and add the code from [here](https://gist.github.com/brandonb927/5283527#file-com-user-evernote_markdown-plist) #### Step 5) #### Create the script `evernote_selection.sh` that will run on boot anywhere on your computer, but remember toreference it in `com.user.evernote_markdown.plist`. Code is [here](https://gist.github.com/brandonb927/5283527#file-evernote_selection-sh) #### Step 6) #### Add the executable bit to the file with -
Brandon Brown revised this gist
Apr 4, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,7 @@ Create the script file then paste the contents of the Python script into evernot Create a file called `com.user.evernote_markdown.plist` in `~/Library/LaunchAgents` and add the code from [here](https://gist.github.com/brandonb927/5283527#file-com-user-evernote_markdown-plist) #### Step 5) #### Create the script `evernote_selection.sh` that will run on boot anywhere on your computer but remember reference it in `com.user.evernote_markdown.plist`. Code is [here](https://gist.github.com/brandonb927/5283527#file-evernote_selection-sh) #### Step 6) #### Add the executable bit to the file with -
Brandon Brown revised this gist
Apr 4, 2013 . 1 changed file with 16 additions and 18 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -14,41 +14,39 @@ Uses Evernote's Mac client and [Marked](http://markedapp.com/) (or similar Markd #### Step 1) #### Setup Python so the script can be used. Using the awesome `pip` Python package manager, install 2 packages: html2text and MacFSEvents $ [sudo] pip install html2text MacFSEvents (**Optional**) Unless you are already familiar with Python, you may not have `pip` installed. Skip to the bottom for how to do this #### Step 2) #### Create the file `EvernoteSelection.md` in ~/Documents or wherever you want this file to sit, just remember to reference it in the script. It is essentially a cache file and contains only the information of your Evernote when you hit save. #### Step 3) #### Create the script file then paste the contents of the Python script into evernote_selection.py $ [sudo] touch evernote_selection.py #### Step 4) #### Create a file called `com.user.evernote_markdown.plist` in `~/Library/LaunchAgents` and add the code from [here](https://gist.github.com/brandonb927/5283527#file-com-user-evernote_markdown-plist) #### Step 5) #### Create the script that will run on boot, anywhere on your computer but remember reference it in `com.user.evernote_markdown.plist`. Code is [here](https://gist.github.com/brandonb927/5283527#file-evernote_selection-sh) #### Step 6) #### Add the executable bit to the file with $ [sudo] chmod +x /path/to/evernote_selection.sh` #### Step 7) #### Logout and login again #### Step 8) #### Save a note in Evernote with the content using Markdown syntax, then start Marked.app and open `EvernoteSelection.md`. You should now see the Markdown preview of your note! ## Install pip Python package manager ## To install `pip` the proper way, give the [Python Guide](https://python-guide.readthedocs.org/en/latest/starting/install/osx/) a read through. For the lazy or inexperienced, install `pip` in one go: (**Note**: `[sudo]` is whether or not you need `sudo` to run commands.) $ [sudo] easy_install pip -
Brandon Brown revised this gist
Apr 4, 2013 . 2 changed files with 15 additions and 0 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.user.evernote_markdown</string> <key>Program</key> <string>/usr/bin/python /path/to/evernote_selection.py -d</string> <key>RunAtLoad</key> <true/> </dict> </plist> 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ #!/bin/sh /usr/bin/python /path/to/evernote_selection.py -d -
Brandon Brown revised this gist
Apr 3, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -19,7 +19,7 @@ file = "Documents/EvernoteSelection.md" libpath = "Library/Containers/com.evernote.Evernote/Data" filepath = os.path.join(home, file) datapath = os.path.join(home, libpath) def cb(*args): -
Brandon Brown revised this gist
Apr 1, 2013 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2012 Brandon B. <[email protected]> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long -
Brandon Brown revised this gist
Apr 1, 2013 . 1 changed file with 14 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -9,11 +9,23 @@ now = lambda: time.mktime(time.localtime()) last = now() """ Change these variables if needed -file : You must create and name this file, place the file path here -libpath : If it exists, use ~/Library/Containers/com.evernote.Evernote/Data otherwise, use ~/Library/Application Support/Evernote/data """ file = "Documents/EvernoteSelection.md" libpath = "Library/Containers/com.evernote.Evernote/Data" filepath = os.path.join(home, path) datapath = os.path.join(home, libpath) def cb(*args): global last if now() - last > 1: codecs.open(filepath, "w", "utf-8") \ .write(html2text(os.popen("""osascript -e \ 'tell application \"Evernote\" if selection is not {} then @@ -27,5 +39,5 @@ def cb(*args): cb() observer = Observer() observer.schedule(Stream(cb, datapath)) observer.start() -
Brandon Brown revised this gist
Apr 1, 2013 . 1 changed file with 47 additions and 4 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,54 @@ ## Overview ## Uses Evernote's Mac client and [Marked](http://markedapp.com/) (or similar Markdown-preview app) to allow you to create Markdown-style notes and preview them. ## Requires ## - Evernote's Mac client - [Marked](http://markedapp.com/) (or similar Markdown-preview app) - Some Python and commandline knowledge ## Setup ## #### Step 1) #### Setup Python so the script can be used. Using the awesome `pip` Python package manager, install 2 packages: html2text and MacFSEvents ```shell $ [sudo] pip install html2text MacFSEvents ``` (**Optional**) Unless you are already familiar with Python, you may not have `pip` installed. Skip to the bottom for how to do this #### Step 2) #### Create the file `EvernoteSelection.md` in ~/Documents or wherever you want this file to sit, just remember to reference it in the script. It is essentially a cache file and contains only the information of your Evernote when you hit save. #### Step 3) #### Create the script file then paste the contents of the Python script into evernote_selection.py ```shell $ [sudo] touch evernote_selection.py ``` Make the necessary edits to the Python script and save it somewhere. Make the script executeable and run it ```shell $ [sudo] chmod 775 evernote_selection.py $ [sudo] python evernote_selection.py ``` #### Step 4) #### Save a note in Evernote with the content using Markdown syntax, then start Marked.app and open EvernoteSelection.md. You should now see the Markdown preview of your note! ## Install pip Python package manager ## To install `pip` the proper way, give the [Python Guide](https://python-guide.readthedocs.org/en/latest/starting/install/osx/) a read through. For the lazy or inexperienced, install `pip` in one go: (**Note**: `[sudo]` is whether or not you need `sudo` to run commands.) ```shell $ [sudo] easy_install pip ``` -
Brandon Brown revised this gist
Apr 1, 2013 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -27,5 +27,5 @@ def cb(*args): cb() observer = Observer() observer.schedule(Stream(cb, os.path.join(home, "Library/Containers/com.evernote.Evernote/Data"))) observer.start() -
Grigory V. revised this gist
Nov 10, 2011 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -4,4 +4,8 @@ First, ```shell $ [sudo] pip install html2text MacFSEvents ``` Then launch it and enjoy. P.S. guess what, ⌘S works in Evernote. -
Grigory V. created this gist
Nov 10, 2011 .There are no files selected for viewing
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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE Version 2, December 2004 Copyright (C) 2011 Grigory V. <[email protected]> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed. DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. You just DO WHAT THE FUCK YOU WANT TO. 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,7 @@ Evernote's Mac client + [Marked](http://markedapp.com/) or similar: basically just setting ~/Documents/Evernote Selection.md to the content text of current note converted from HTML to Markdown. First, ```shell $ [sudo] pip install html2text MacFSEvents ``` 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ #!/usr/bin/env python import os import time import codecs from html2text import html2text from fsevents import Observer, Stream home = os.environ["HOME"] now = lambda: time.mktime(time.localtime()) last = now() def cb(*args): global last if now() - last > 1: codecs.open(os.path.join(home, "Documents/Evernote Selection.md"), "w", "utf-8") \ .write(html2text(os.popen("""osascript -e \ 'tell application \"Evernote\" if selection is not {} then set the_selection to selection return HTML content of item 1 of the_selection else return \"\" end if end tell'""").read().decode("utf-8"))) last = now() cb() observer = Observer() observer.schedule(Stream(cb, os.path.join(home, "Library/Application Support/Evernote/data"))) observer.start()