Tag: line

HabitRPG and Remember the Milk Synchronization on the Command-Line

If you, like me, are a user of both HabitRPG and Remember the Milk, you may have been looking for a way to link the two. I developed habitrpg-todo-sync (HabitRPG Todo Synchronization) to do just that.

The README file explains in good detail how to use it.

Come on, just tell me how to use it

OK, here’s the quick version (you need NPM installed, which you get with Node.js):

npm install -g habitrpg-todo-sync


It will tell you what to do from there.

Full synchronization

You might be interested in running

habitsync -a

to do a full synchronization of your tasks. By default, it only retrieves the last week of them.

Don’t synchronize¬†everything

You may not want to get all your tasks. habitrpg-todo-sync can make use of Remember the Milk’s advanced search interface (ever tried typing something like addedWithin: 1 week ago in their search box?).¬†Here’s how:

habitsync –filter=”list:Name of Your List”

You can do anything you can do with their interface.

And you can combine command-line options:

habitsync -a –filter=”list:Smart List You Want To Sync”

Run on a schedule

You can run it manually or add it to cron. I have this in my crontab, which runs it every hour against beta.habitrpg.com (which is often more likely to be working). To put it in yours, you generally run

crontab -e

and then add the following line:

# min hour mday month wday command
*/60 * * * * /usr/local/bin/habitsync -qB

You can separate each argument with spaces or tabs, and you don’t need the first line. I just included it for completeness.

It doesn’t do what I want.

Tell me! I really want to hear back from users of it. When I don’t, I assume nobody cares, and I improve it much more slowly. Report issues on GitHub.

Linux sed trick – Remove line from file by number

I wanted to document this before I forgot it. To remove a single line from an existing file with sed, use:

sed -i '[num]d' [filename]

For example, to remove line 1 from ~/.ssh/known_hosts (my exact use case right now), type:

sed -i '1d' ~/.ssh/known_hosts

sed is a neat little tool. I use it to quickly copy and change Apache virtual hosts sometimes as well. I recommend learning a bit about it and its ‘s’ command as well.

P.S. If you don’t use the -i switch, sed will output the result after replacements instead of changing the file. You can pipe (|) this output to other programs or redirect (> or >>) it to a file.

Happy sed…ing.