Starshun

The occasional ravings of James Kellerman

IFTTT, Hazel and Day One

I have been expirementing with integrating more passive data collection into Day One. As Day One doesnt have a cloud service to push data through it requires a slightly more complex workflow. While researching a way of getting more of my internet data into Day One I came across this article on poor signal showing how to integrate IFTTT, Hazel, Dropbox and Day One.

So what data am I collecting in Day One.

  • The tracks I play on Rdio via lastfm.
  • Fitbit Daily Stats
  • Fitbit Weight
  • Pocket new articles
  • Pinboard new bookmarks
  • A selfie snapped automatically from macbook pro facetime camera
  • A note every time I go to the climbing gym or weights gym
  • New Linkedin contacts

All this gives me a personal archive of all the data that I create passively.

Script to add a selfie every day to Day One

I was looking over an old backup when I came across a series of photos that I had taken as part of a picture a day project. Looking back on the photos was interesting; the different places, clothes and hairstyles that are the boring minutae of most days are rendered fascinating by their setting in a sequence. These were all ungaurded moments that reminded moI liked the photos but I wanted a better place to put them. Day One seemed like the perfect answer I was alredy using it for journaling and it supports a great command line interface.

What does it do? Snaps a photo at startup from your macbookpro camera and at 9:30 every morning. It then saves that image to a folder using the date for the filename and posts it to your day one journal.

What does it need to work

ImageSnap A comman line utility for taking pictures with the built-in isight camera. The easiest way to install this is via homebrew: brew install imagesnap

Day One A fantastic journaling application

Day One Command Line Tools Command line tools for Day One

Once you have all these installed you can use the following simple script to link it all together.

#!/bin/bash    


# The file name here we are using the date in Y-M-D format
FILE=$(date +"%Y-%m-%d").jpg

# the image path to save the image
IMAGEPATH=/Users/jkellerman/Dropbox/Images/me/


FILEPATH="$IMAGEPATH$FILE"


# Snap the photo
/usr/local/bin/imagesnap "$FILEPATH"

# Add the iamge to dayone
echo "Daily Image" | /usr/local/bin/dayone -j="path to dayone journal" -p="$FILEPATH" new

# Sleep to stop lauchd thinking we are just dying
sleep 10s

The last thing you need is a launctl plist file that tells the script when to run. Here is the one I am using to run the script every day at 9:30am. This lives in /Library/LaunchDaemons/

 

<?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.example.exampled</string>
<key>ProgramArguments</key>
<array>
<string>/bin/sh</string>
<string>/Users/jkellerman/scripts/isighttodayone.sh</string>
</array>

<key>KeepAlive</key>
<false/>

<key>RunAtLoad</key>
<true/>

<key>StartCalendarInterval</key>
<dict>
<key>Hour</key>
<integer>9</integer>
<key>Minute</key>
<integer>30</integer>
</dict>


</dict>
</plist>