Beeminder Forum

Very basic shell script to beemind pomodoros using Flowkeeper

Since everybody is posting their elaborate hacks to beemind pomodoros, I thought I would post the very simple script that I use. Although I am awed by some of the other posts on this topic, this script might be useful for people who want to beemind pomodoros in a basic way.

I use Flowkeeper for the pomodoro technique; it is a very lightweight Java piece of software for desktops (I use Kubuntu, but it is cross-platform).
The following shell script is automatically executed once a day:

update1=$(diff flowkeeper.xml flowkeeper.xml.bee.old | grep "completed" -c)
update2=$(diff flowkeeper.xml flowkeeper.xml.bee.old | grep 'workitem [[:alnum:] [:punct:]]* status="completed"' -c)
update=$(($update1 - $update2))
thisdate=$(date +%s)
mystring="auth_token=INSERT_TOKEN&timestamp=${thisdate}&value=${update}&comment=from+api"

if test $update -ne 0
then curl --data $mystring https://www.beeminder.com/api/v1/users/USERNAME/goals/pomodoros/datapoints.json
cp flowkeeper.xml flowkeeper.xml.bee.old
fi

If you want to use it, simply copy the code above into a file called beepom.sh (in your home folder), insert your own auth token and username, make the script executable, and either call it manually (./beepom.sh) or have it execute automatically. You’ll need to make sure that your Beeminder goal is set to auto-summing (which is the default for Do More goals).

[Edited to add: I have tested this on a couple of Linux distributions. I guess it also works on Mac OS. It won’t work on Windows, however.]

4 Likes

I really, really want to Beemind pomodoros. But I am not a coder. I thought I’d try your script, but here is my thinking and where I get stuck (sorry for the all caps–just wanted to show my thinking):

“simply copy the code above into a file called beepom.sh” [OK, CAN I DO THAT IN WORD? OR NOTEPAD?]
(in your home folder), [I DON’T KNOW WHERE THAT IS OR WHAT IT IS]

insert your own auth token and username, [DON’T KNOW WHAT AN AUTH TOKEN IS]

make the script executable, [HOW?]

and either call it manually (./beepom.sh) or have it execute automatically [HOW?]

I completely understand if it is too much to ask to explain all this. Probably like explaining multiplication to a 2 year old…I can always wait for Beeminder to make this an official integration.

1 Like

PS. I even went on Code School and did two tutorials–one on GitHub and one on Objective-C, so there’s a good faith effort here to learn, but it didn’t help with my basic, basic questions :smile:

1 Like

This is a very valuable reminder of how much more opaque technical instructions can be than we realize. And you may be right that this rabbit hole goes too deep, but let me try to help!

  1. The script has to be saved as plain text, so Notepad, not Word.
  2. Oh crap, if you’re on Windows I don’t know the answers to some of these questions. On Mac or Linux, “~” is a shortcut to your home directory. What directory the script is in shouldn’t actually matter though.
  3. If you look at the first section of the Beeminder API it has a link to get your auth token. It’s a 20-character string like ax2Z4blahblah.
  4. On Mac or Linux you can make a script executable with chmod a+x filename but that assumes you know your way around a terminal / command line interface. (Maybe there’s enough to google in the previous sentence?)
  5. I again don’t know the Windows equivalent but on Mac or Linux you can set up a cron job to automatically run something once a day (or once an hour or even once a minute). But for @robin’s script it might not be onerous to run it manually because you only need to do that when it’s a beemergency. Do your pomodoros and then run the script and see if Beeminder is happy. If not, do more and run it again.

PS: I see Robin amended his post to say that this just won’t work on Windows. If you’re really a glutton for punishment you could actually make it work in Windows by installing Cygwin, which makes Windows act like a normal Unix system, like Mac or Linux.

1 Like

Thanks Danny for the clarifications!

Indeed, I don’t think that this script can work for Windows. Maybe small
adjustments would be sufficient to make it work on Windows, but I don’t
have the technical knowledge for that, sorry.

I’ll just add to point 4. that you can also make a script executable by
right-clicking and modifying the properties.

Robin

1 Like

Daniel,

Thank you so much for this thorough post! If I had a Mac, I would totally do this. I am so impressed by how responsive you (and the Beeminder community) are to posts. What a great community. (And thanks for not making fun of my ignorance on this topic.)

I guess I will wait for the official integration. I’m sure it’s on your lengthy to do list!

Michele

1 Like

@tierrabluebird I’m in a similar position of wanting to Beemind pomodoros and lacking hackery skills. I’ve had success with getting @maggied’s Strict Workflow modification to work on my computer, opening up a whole new world of pomodoro potential! If you use Google Chrome for browsing it’s definitely worth a shot.

3 Likes