An "Unfuck Your Habitat"-like program for Linux/Unix/macOS
Unfuck Your Habitat is a website that exhorts readers to clean their "habitats." It does this with daily prompts posted at regular times -- clean your bedroom, make your bed, prepare for the next day, etc.
There's also a companion app for iOS. It's a great concept. You fire it up, you tell it whether you want a chore that lasts 5, 10, or 15 minutes, and you get an appropriate prompt. Maybe it's a sad comment on my willpower, but I find it a lot easier to let a program tell me what to clean than to summon up the initiative myself. But the trouble is that none of the program's prompts was specifically written for me. Happy with the concept but without an easy way to edit the program's prompts, I decided I would craft my own Unfuck Your Habitat app.
I wanted my program to be tailored exactly for my needs. It had to give me prompts for cleaning my habitat -- no bullshit about basements or yards or garages. This was easy enough, as we'll see. It also had to be accessible to me at just about any time. Having it tied to one specific computer or operating system wasn't going to work. Since there was no way I could get it on a phone, the best way to meet this requirement was to run it on the server I am connected to via ssh 99.5% of the time I'm at a computer.
So what I came up with is quite simple. I have a plain text file with one chore to each line. The sort program has an option to sort the lines of a file in a random order. Pass this shuffle output to the head program, specified to show only the first line it receives, and you can easily display a single random line from any text file:
sort -R .unfuck | head -n1
I have this aliased so that all I ever need to do is type unfuck at the command line to get my chore. I even set it up so that every 60 seconds this prompt is written to a text file in the directory from which my webpage is served. Now, even when I don't have a command line, I just open up a bookmark on my phone and see the command from on high to clean my apartment.
Here are specific steps to follow if the above description is a bit vague.
- Create a file -- I called mine .unfuck -- that has all your chores, each one on its own line. Try to make these chores all about equal in the amount of time or effort. Unlike the iOS app, we're not going to have any way of choosing between easy and hard chores.
-
In the file where your store aliases (.profile for ksh), add a line like
alias unfuck='sort -R .unfuck | head -n1'
. - Type unfuck at the command line to get your chore.
If you have a webserver on the machine, you can do something like this in cron as well:
*/1 * * * * sort -R /home/user/.unfuck | head -n1 > /var/www/htdocs/unfuck.txt