Friday, January 9, 2015

Create new Todoist task from Mac Outlook

It can be very challenging if you are in the midst of dozens of emails a day to even get near a zero-inbox.  As of this writing, I am over 300 messages sitting in my inbox.  I have a relatively simple AppleScript which I have pieced together from a few different sources.

First, copy the script (below) to your local machine into your user folder ~/Library/Application Support/Microsoft/Office/Outlook Script Menu Items.

You can navigate to that path in a new Finder window by holding the Option key and opening the Go menu.  You should see the Library option appear there.  Now, just follow the path to the location mentioned above.

After you create  the file there, create the file todoist-token.txt. In this file, you'll want to copy the API token from your account in Todoist.  Open your browser, navigate and login to Todoist.  Once you see your task lists, click the wheel and navigate to Settings.  Once there, select Account.  In the bottom half to the window, you'll see API token.  Copy that token and place it in the file, todoist-token.txt.  Make sure there are no new lines below the token.  This will cause an error when parsing that file.

Once you have completed these two steps, it should be possible to open Outlook, select a message and send it to Todoist.  Click the AppleScript icon in the menu bar and locate Todoist Task.  Clicking this will automatically send it to Todoist and move the message in the folder "Archive".

Features of this script:

  • Create a new task in Todoist.
  • Create a new note on the Todoist with the body converted to plain text.
    • NOTE: Todoist does not support HTML notes at this time.
  • Archive the message to your "Archive" folder.
Also, view this script on github.  For further enhancements and fixes - https://github.com/mhorner/OutlookToTodoist




(*
Create Todoist task from email

*)

on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars

-- get todoist token from text file
set todoistToken to my replace_chars(read file ((path to home folder as text) & "Library:Application Support:Microsoft:Office:Outlook Script Menu Items:todoist-token.txt"), "
", "")

tell application "Microsoft Outlook"
-- get the currently selected message or messages
set selectedMessages to current messages
-- if there are no messages selected, warn the user and then quit
if selectedMessages is {} then
display dialog "Please select a message first and then run this script." with icon 1
return
end if
repeat with theMessage in selectedMessages
-- get the information from the message, and store it in variables
set theName to subject of theMessage
set theSender to sender of theMessage
set thePriority to priority of theMessage
set theBody to content of theMessage
if thePriority is priority high then
set thePriority to "4"
else
set thePriority to "0"
end if
-- remove new lines from the body first
set theBody to do shell script "echo '" & theBody & "'| tr -d '\\r'"
-- remove HTML tags from the body creating a plain text output
set plainText to do shell script "echo '" & theBody & "' | /usr/bin/textutil -stdin -convert txt -stdout"
-- create a new task with the information from the message
set newItem to do shell script "curl -X POST -d 'content=" & theName & " for " & name of theSender & "' -d 'token=" & todoistToken & "'  -d 'priority=" & thePriority & "' -d 'date_string=today' https://todoist.com/API/additem -d 'note=" & plainText & "'"
set theAccount to account of theMessage
set archiveFolder to folder "Archive" of theAccount
move theMessage to archiveFolder
end repeat
end tell

Monday, December 15, 2014

Being funny or just?

I took an update to Remote Desktop for Mac in the last few days and finally started the app.  Upon launch I was greeted with the following "What's new in 8.0.12".  

Yosemity or Yosemite?


I get it.  It's Microsoft playing in Apple territory.  Is that a poke at Apple?  Or just some lazy developer/QA that didn't bother to check on the correct spelling for Apple's 10.10 release of Mac OS, dubbed, Yosemite?  Or for that matter, run spell check?

I'll let you decide.  I have my opinion.

Thursday, April 3, 2014

Reversing launchctl of Plex (PMS)

In my previous post, I covered adding the behavior to support launching the Plex Media Server (PMS) after logging.  That was fine, except the extra cycles stolen from the general use of the machine was making the machine more painful to use.  With that, I am going to cover reversing the actions from my previous post to auto launch PMS after log in.  This will provide the needed resources that are required for the users at the machine.

First up, looking in the folder, /Library/LaunchAgents.  This proved to be a dead end.  The plist file originally entered there was now gone or I changed my mind (and don't remember).  I then looked in /Library/LaunchDaemons.  It sort of sounds the same, so why not right?  Again, nothing.  Hmm.

Well, worse case scenario, I know the file name.  I can just use the find command.
find / com.plex.pms.plist | grep plex.pms
Fairly brute force, but it worked!  In a matter of a couple of minutes I found my file.  It was in the directory, /System/Library/LaunchAgents.  It has been a while, so I don't recall placing the file there.  A quick change directory command into the folder and we can start surgically removing the auto launch of PMS.  First, let's unload the launch agent.
launchctl unload com.plex.pms.plist
Next, you can move or remove that file from the directory.  This will ensure that PMS doesn't automatically load when a user logs into the machine.

Now log out and log back into to your account.  You should see that you're no longer launching PMS at log in.

Tuesday, October 15, 2013

Auto-launch Plex Media Server on Mac OS X

I set out to find a solution that would load Plex Media Server (PMS) as a daemon process at the time my Mac booted.  I found that some folks were actually working on this solution.  The main solution I found was using an open source project, PlexConnect.  I tried a few different attempts at it.  I decided with my lack of interest in setting the whole solution up and the amount of seemingly direct ties to Apple TV, it was not the solution for me.

I found a plist file, com.plex.pms.plist on gtihub.  I dropped this file in to my /Library/LaunchAgents folder.  Soon I discovered the power of launchctl.  I added this plist through launchctl with following command.
launchctl load /Library/LaunchAgents/com.plex.pms.plist
Voila!  PMS was starting.  I tried to quit PMS and suddenly it was starting again.  This seemed promising.  Now I discovered that I had originally set up PMS with the current login.  Later I created a Plex account that then held all of my content.   I also wanted to have PMS auto launch with any of the primary logged in accounts.  This machine will generally have one of the logged in accounts active on the machine.  It is the primary machine for the house.

I started to investigate where PMS stored all of it's information.  I found information regarding for removing PMS from my mac, on the wiki.  Thus, I devised a plan.  I wanted to centralize that data into one location so that I could have any of the primary accounts login and the data presented on my Roku was the right data.

I created a folder in /var named Plex.  I re-created all of the primary directories inside of this folder mimicking the folder structure in a user account and moved those folders from the Plex user account.
  • Library/Application Support/Plex Media Server
  • Library/Caches/PlexMediaServer
  • Library/Preferences/com.plexapp.plexmediaserver.plist
After I moved all of that data to the /var location, I symlinked each of these locations into the two primary accounts as well as the Plex account.  In order to ensure that the data was fully accessible, I also made the /var/Plex/Library folder readable/writable by the Plex account and the group "everyone". This will ensure that if new data is found on my NAS drive holding my data, that it will be added regardless of the account launching PMS.

A relaunch of PMS and the Media Manager showed the information from my library as it was originally set up. This isn't the greatest solution, however, it works and satisfies my needs and requirements.  I could not make much head way with the other solutions or the lack of solution offered by PMS.


Sunday, September 30, 2012

Sweet Stout Journal - Wrap Up @7brewing

In this post, I'll wrap up the brew day with notes, recipe and final results.

After a somewhat turbulent brew day yesterday, I have a beer that is bubbling away this morning.

Fixed Mash Tun Filter
I encountered a few snags along the way.  First was the stuck or pinched filter in my mash tun.  Once I opened up the filter the wort was flowing quite nicely.  It may have been assisted by the high volume and temperature which increased the overall wort viscosity.  Once the filter was corrected, the wort start to flow freely.

While chilling, the exit hose from the copper chiller come loose from the fitting.  I then had to turn off the water and reattach the hose back to the fitting and then hook it all back up.  Once that was fixed, the temperature of the beer dropped pretty quickly.  It seems that the water temperatures from our city water are dropping with the shorter days and cooler temperatures.  I managed to cool the wort to about 68 degrees.  This was well within the range for pitching the yeast.

The recipe I brewed yesterday, originated from this Northern Brewer recipe.  The recipe was tailored to a brew house efficiency of 80%.
Transferring to Fermenter
Mash Water (All City Water)

Total grain (lbs) : 8
Target Mash Water Volume: 2.5 gallons
Final Mash Water Volume: 3.75 gallons
Sparge Volume: 4 gallons
Mash Temperature: 152 degrees


Grain Ingredients
Color of the Sweet Stout7 lbs Marris Otter (Pale Malt)
0.5 lb Carafa III
0.5 lb Chocolate Malt

Boil Additions
0.7 lb Milk Sugar (Lactose)
1 oz Willamette (hops)
Total Wort to Kettle: ~6.25 gallons
Total Wort to Fermenter: ~5+ gallons

Here are the original gravity (OG) and final gravity (FG) readings according to BeerSmith v1.4 and measurments.
OG estimated : 1.053
OG for style: 1.044 - 1.060
OG actual: 1.056
Actual brew house efficiency: 85%

FG estimated: 1.014
FG for style: 1.012 - 1.024
FG actual : TBD

If the FG comes in at 1.014 as estimated, this beer should have about 5.48% alcohol.  Not a very big beer, but still comes in above a session beer.  I anticipate it will be a very tasty beer.  I hope to introduce the milk stout for the first time to several people and spark some intrigue in this beer and style.

Thank you for reading along.
- Matt

Please follow any of the references throughout this series of posts for definitions to the terms and information that went into this brew.

Saturday, September 29, 2012

Sweet Stout Journal - Post Mash @7brewing

Next we'll move to the post mash step.  But first, a little nugget of information.

Earlier this week I listened to the BeerSmith.com podcast #39 with Gordon Strong.  Gordon discussed the water conditioning and addition of darker malts to the mash.  He pointed out the idea that darker malts do not require a mashing step as it does not require any enzymatic conversion and provides a charring or burnt flavor to the beer.  

Why do I mention this?  Well, as much as I would have liked to try this during this brew, I came to the realization that I need to understand first how to bring my water temps up for a mash out step.  I am using a cooler configuration like the one detailed by Denny here, BREWING WITH DENNY.  I suspect that I could use the sparge water to bring my total volumes up while increase the mash temps.  However, I didn't want to necessarily alter my brewing process this time without doing the necessary research.  I am detailing the idea here for future reference, more so than anything and potentially generate some conversation.

First before transferring the first runnings to the brew kettle, I have to heat 4 gallons of sparge water to complete the rinsing process of the mash.  

4 gallons of sparge water heating.
It's time to start transferring to the boil kettle after 60 minutes of mashing.  The color should be fairly dark.  


The drain and filter I have is beginning to slow down during run off.  It seems to be pinched or clogged with and requires a little finagling to move the wort from the mash tun.

I ended up pulling the filter out and jamming the end of a wooden spoon down the filter to re-expand it. This simple fix actual increased the flow considerably from a slow trickle to only being held up by the diameter of the valve and drain tube.
Before
After










Now the wort is on to boil.  I have added 1 ounce of Willamette and 0.70 pounds of lactose.  Another topic on the podcasts from BeerSmith.com discussed timing of hop addition.  The discussion lead to adding the hops pre-boil to give the beer a much smoother less harsh bittering taste.  I decided to give this a try and see what the results of that modification would be to my beer.


I'll complete the boil process, chill it, transfer to the fermentation and finally pitch the yeast.  My next post will detail the recipe, today's results and wrap up of the whole brew.  Thanks for reading along.

Sweet Stout Journal - Mash @7brewing

Today, I am brewing up a Sweet Stout or Milk Stout.  A Sweet Stout is a dark beer with a bit sweetness that is added by lactose or milk sugar. The lactose provides an amount of unfermentable sugar or sugar that is not metabolized by the yeast.  This sugar is left over at the end of the fermentation process and contributes to a unique sweetness in the beer.

The first milk stout I tasted was produced by Wynkoop Brewing Company during a business trip out to Denver in 2010 or 2011.  I was intrigued by the sweetness and immediately thought "I need to brew this".  I like varieties of hoppy and malty beers, but the sweetness of the milk stout is quite different and done right can have a very smooth flavor.

First tip of day:  Pay attention to the water temperatures.  For 3 out of the last 5 brews, I have started with overheating the mash water.  This not only requires returning the water to the target temperature but adds an unnecessary amount of time to the brewing process.

Working with small volumes of mash water makes it challenging to maintain temperature for mashing in.  Starting with 2.5 gallons of water heated to 164 degrees, I mashed in 8 pounds of grain.  After mashing in I took a temperature reading of the mash and found the mash was at 146 degrees.  A full 6 degrees below the target mash temperature of 152 degrees.

(Excuse the photo quality from my iPhone 3GS.  My iPhone 5 is on order.)

I made a first attempt to bring the temperature up by adding .5 gallons of water heated to about 190 degrees.  This raised the mash temperature to about 148 degrees.  Typically, I have not checked the mash temps before setting up for the 60 minute mash.  This could alter the flavors of the beers I generally brew and points to the idea that better control over the mashing process.

I added another .75 gallons of water heated over 180 degrees and got within my target.

Mash Water
Total grain (lbs) : 8
Target Mash Water Volume: 2.5 gallons
Final Mash Water Volume: 3.75 gallons
Mash Temperature: 152 degrees

To meet volumes to the boil kettle, the sparge water will be adjusted by 1.25 gallons.