I am very much a newbie at bash scripting in Terminal, but I felt tempted to replicate the tool I built at TaskPusher for the command line: namely to send text and an optional action to Drafts from a Mac OS computer.
TaskPusher is a PHP web application that sends an url-encoded string to Pushover, a notifications app for iOS. Pushover already provided the code to send notifications from the Unix command line so I only had to make a few modifications to send a message to Drafts.
Before we begin, I need to qualify that I literally have only started bash scripting this week, so please bear with me if there are any inefficiencies or errors. The script works, but if you have any suggestions please comment below in the Disqus widget or send me a tweet.
The first challenge is that all the text after the Drafts URL scheme
drafts:///create?text= needs to be url-encoded. I found a basic sed find/replace script here and I copied the code snippet into this gist:
Just add this in a text file somewhere in your directory and call it
urlencode.sed. I haven't gotten to move new scripts into /usr/local/bin (or what-have-you) so in the pushover script below you will have to precede
urlencode.sed with the directory path. In my working script I replace it with
I named the following script
pushover but you can call it whatever you want:
If you haven't already, purchase Pushover in the app store, create an account and get your user key. Then create an app in Pushover and save the API token. Where it says $APP_TOKEN and $USER_KEY enter yours in the script.
Now go to Terminal. You need to set one or two variables to send to Drafts: the message and the action. The message is the actual text of your draft. The action is the exact wording of any of the actions in the Action Directory. For example, I may want to send text to Due: 6pm pick up prescription. In Drafts, the action is called Send to Due. So on the command line, I type the following:
export message="6pm pick up prescription" export action="Send to Due" pushover
(In my case, I type
~/j/scripts/pushover. If Terminal says you don't have permission to run the script, type
chmod 700 pushover.)
Your notification will be sent to Pushover, and you'll get a status response on the command line. When you get your notification, just swipe to open it, and tap on the URL string. In the example above, it would look like
When you tap on the URL, it will send the text to Drafts and tell Drafts to send that text to Due.
If you just want to send text to Drafts and not immediately act on it, just leave the action variable null. To clear the action variable from a previous notification, type
There are additional variables you can add to the script (as defined in Pushover's API) if you want to send your notification to a specific device or customize the sound. Just add an additional line in the script, like
-F "sound=cashregister" \.
I recently showed how you can read RSS feeds in Fargo. Did you know that you can "subscribe" to complete OPML lists in Fargo as well? Feedshare.net is a place where people share their feed reading lists. If you want to see what Brent Simmons reads, go to his share page and grab his OPML link. Then go into Fargo and add this link as an include.
I just typed "Brent Simmons - Inessential" on a new headline and added the following attributes to the headline:
I then expand the headline to see all the feeds it includes:
and then use the "View Feed" script (outlined in my previous blog post) to read one of the feeds:
Eric Davis has written a script to enable a user to read RSS feeds in Fargo. The script does not beautifully render the contents of the description tag, but if you want a quick-and-dirty solution, this will work. For example, if you're compiling research in an outline and only plan to check a related RSS feed when you're working in that tab, you can just update the feed there.
At bare minimum, you need a menubar.opml file. Add the following script to that outline:
This script calls a longer script. I suggest you copy this entire page to your clipboard, paste it into a new text file, title it
rssReader.js, and save it somewhere in your Dropbox. Then make that file shareable and replace
DOMAIN.COM/rssReader.js in the first script with that Dropbox URL. (Mine looks like
In any outline, type the name of a blog on a headline. Then all you need to do is add the RSS feed as the value of the
xmlUrl attribute. You can use this script to easily add a feed:
You do not need to add the
type="rss" attribute to this headline to make it work.
Then go to your scripts menubar, choose View Feed, and the items will show below the headline. If you open the headline of a title, you will see the description content for that feed. (If a publisher chooses to include the entire content of a post within the description tag, it will all be formatted as one long headline, so it is not ideal for reading, but rather for getting a sense of whether you want to read the full post at the publisher's site.)
If I want to read the full post, I make sure the cursor is on the headline of the post title, and I view it in Instapaper without saving it, or save it to Instapaper:
Or I can just read the post in a new window:
I use a keyboard shortcut to trigger the View Feed script. If I could remember who wrote what I would provide credit, but unfortunately I don't remember -- I grabbed these ideas from one of the Fargo google groups and/or the community feed that existed when Fargo was first launched.
First, create a text file called
myVerbs.js and put it in your /Apps/Fargo folder.
Put the following code in it:
(You can change
daveVerbs or whatever you want as long as you use the name consistently. And make sure to replace domain.com with your shareable Dropbox URL.)
Then, in Fargo, click on your name at the top right, then choose Settings and go to the Code tab. Put this in the Startup field and hit Save:
After you reload Fargo, you should be able to have your cursor on a headline that has a feed and hit Control-E to trigger the View Feed script. (Note that this totally depends on whether there is a conflicting mapping on your computer. I use Chrome for Mac and it works for me.)
I haven't "clubbed" for a long time -- I don't like stay up super-late (even on weekends) and dance clubs are not really my scene. Mostly I stay within my 5Rhythms cocoon, regularly attending Tuesday and Friday classes in Manhattan.
However, I have followed Tasha Blank for years as she's DJ'd at more holistic spaces in the city. She started with Get Your Dance On first at Brooklyn Bowl and then at various yoga studios, and over the last year she has been DJing at The Get Down at Cielo.
Cielo is an EDM dance club in the meatpacking district, where the doors don't even open until 10pm. But The Get Down starts at 7, so that you can enjoy the clubbing experience and still get a decent night of sleep before going to your 9-5 job (if that's your lifestyle). But unlike the yoga studio dance experience, at Cielo you can drink (in fact you need to be at least 21 to enter) and you have to wear shoes.
I showed up shortly before 7 as the 1/2-hour pre-dance meditation was wrapping up. I felt in my comfort zone because a great number of people at the event were familiar faces from 5Rhythms classes or other dances hosted by Tasha. The music was great -- other DJs were Soultek and Sascha Lewis, and they were accompanied by live violinist Jourdan Brandt and vocalists (for lack of a better word) Akil and Elana Meta.
The floor got more progressively packed as time passed (it's not terribly large to begin with) so I danced at a peripheral location for a while and then edged myself back in. And then the vibe shifted. There were people on the dance floor holding drinks in glasses. (Maybe I just haven't been to a dance club in ages, but who brings glass onto a dance floor?) One glass broke and a few people helped pick up shards. And then more and more "civilians" started entering the space.
I know I am probably just being judgmental, but it seems to me that there are Dancers and then there are Muggles. Anyone who regularly goes to 5R is to me a dancer. He is not dependent on alcohol to allow himself to move freely. She doesn't just stand in a circle on the dance floor with her friends. As more and more "normals" joined the floor, I felt less and less comfortable. (To begin with, I don't feel terribly safe around the combination of "traditional males" and alcohol consumption.)
Another element of the evening that had its pluses and minuses was when the same subset of people would take turns dancing in the middle of a circle, usually doing B-boy or hip hop moves. I'm all for spectacle, but after a while it just seems like a form of grandstanding, not to mention disruptive when there's not much space on the dance floor to begin with.
All in all, I danced for a good 2 1/2 hours to excellent music around many people from my dance community, so it was overall a positive experience. My assessment is that if it were not in a real dance club, most of the negatives described above would not have been present. But I can see how The Get Down reaches that "happy place" for dancers who miss the clubbing experience but don't want to be up until 3am to do it.
I live in Brooklyn and don't own a car. I like that I can travel throughout the city without one, and I feel good that my carbon footprint is smaller than that of a car owner. However, the subway can be an unpleasant experience.
Last night, someone was pissing right on the subway platform (at a column), in front of anyone who happened to be around. And this morning the smell of the subway car I entered was so offensive (a homeless person was sitting at one end) that I debated whether to change cars at the next stop even though this leg of my commute was only two stops.
I know Mayor de Blasio has a grand plan for affordable housing, and I understand that -- for a homeless person -- being "underground" is probably much safer than being on the streets. But when many people are sharing a small space, the actions (or scent) of a single person can mar everyone else's experience.
I know I have it much better than the people about which I am complaining, but I wish the city would do something about it.
This is me dancing there in the back (wearing the elbow compression band) at an event called Morning Gloryville NYC. It's like clubbing, but from 6:30-10:30 am, and without alcohol.