Ask HN: What's are your personal automations?

104 points by iameoghan ↗ HN
Hey HN,

I'm curious to know more about what automations people use day-to-day. Either cron jobs or other services?

Does it make your day easier?

158 comments

[ 3.3 ms ] story [ 252 ms ] thread
Most of my automation has to do with personal data backups/exports and various tools I've developed to process it and use [0]. That would be hundreds of jobs scattered across several of my devices.

I have a tool I wrote which is doing periodic searches for specified queries on different sites and generates RSS feeds with new results + HTML reports (so I can find people with overlapping interests, e.g. if the same person matched against multiple queries) [2]. Sort of like google alerts, but much better. So there is some daily scraping for that.

I'm using a somewhat hacky tool which 'compiles' a python spec for jobs to systemd and makes it very easy to maintain. [1]

As for making my day easier.. not always yet, but certainly makes it more fun. I live by the motto "Never spend 6 minutes doing something by hand when you can spend 6 hours failing to automate it" :)

[0] https://beepb00p.xyz/my-data.html#consumers

[1] https://beepb00p.xyz/scheduler.html

[2] https://github.com/karlicoss/axol

I created a script to tarball my git server's git directory, encrypt it, and backup to Google Drive if new commits were made that day.

inb4 "just use GitHub"

Thoughts on `git bundle`?
Never tried it, didn't know it existed...don't know how it works with untracked files, so it seems safer to just continue tarballing the whole directory like I'm doing now.
A dishwasher is great if you can fill over 50% of it. Will save you couple minutes and effort.
If washing the dishes by hand would take more than 3 min the dishwasher wins on net water usage, regardless of how full it is. It’s marginally more to factor in energy usage.
Coolest hack is 2 dishwashers and alternating them.
For myself, I automated creation of language flashcards.

So I can just type a word/phrase in English, and then it will automatically fill in the target language translation, pronunciation, audio recording, and word-by-word breakdown to show what every word in a phrase means.

Before I would have to use Anki, and switch back and forth between Anki and various dictionaries, and have to create my own audio recording. Just removes a bit of friction myself learning (Chinese).

How do you automate the pronunciation? I’d be curious to know what your process is like.

I have wanted to automate my flash cards with Forvo pronunciations (rather than TTS) for awhile but haven’t been able to figure out how

How did you do that? can you show us a way ?
That sounds very useful, I'd use this
This is amazing. Can you share the code?
Housekeeping service, automatic workstation -> synology nas -> backblaze b2 backup system, shared instacart cart with my wife so that our groceries are tracked where we actually order them.

I've found that a lot of personal automation stuff on the computer just isn't worth it. I try to keep things simple and that reduces the need for automation altogether.

One-line cron job using rclone to sync ~3 TB of photos with the other side of the world. Super simple and reliable.
I’ve mostly given up on tech stack automation for my daily life. But I live and breathe on Reminders.app.
I use to spend a lot of time on Reddit looking for conversations that were relevant to my business. Promoting our products in the context of those conversations usually resulted in sales leads.

I built a tool earlier this year that streams comments from those forums, analyzes them, and pings me when a relevant conversation is found. I generally keep it running throughout the day in my local Terminal.

Would you mind sharing this tool? Or at least more info about how it's built? I'm using huginn to do something similar but it's a bit janky.
> Would you mind sharing this tool

It's not online. I suppose I could spin it into a web application if the demand was there.

Journaling.

I have a shell script that that creates a new markdown file for that day, which I write my journal entry into.

Another script compiles a year's worth of journal entries into an epub.

Another workflow I made is similar, but for tasks. So every day I run a shell script that copies the last day's tasks to a new file with the new day's date, forcing me to evaluate what was done the previous day (if anything). Some days are great, some days not so much.

The tasks also show in my browser's new tab page to further reinforce.

What editor do you use for writing in the markdown files?

I've tried org-journal in Emacs but I could never get over the learning curve of Emacs + org-journal.

I've been using Obsidian recently and I love it. There are all kinds of interesting ways you can graph your posts too.
Wow, can't believe I haven't heard of Obsidian. Thanks for sharing. I'm going to check it out.
Vim. Actually this workflow is what finally got me to start using vim, and now I use vim for everything.
I've tried Obsidian, but after getting used to the inline workflow of Typora I just can't use anything else, even if I'd love to have the graph feature that Obsidian provides.
One of my favorite automations is a slack bot I made to send me a message when a process finishes: https://github.com/spohngellert-o/SlackProcessTrackerBot

As a data scientist I often run code that takes hours, and getting a slack message when it finishes is super helpful, and it has often helped me catch when a script finishes too early due to some error.

I do the same thing, but I use the Twilio CLI to send me a text so that I can get up and walk around if the process is blocking other work. (:
(comment deleted)
Old school: a timer plug to control a window fan in an out-of-sight-out-of-mind location. It keeps us from having to remember to turn the fan in the guest room on and off to get cross ventilation over the summer.
I use the native Apple Shortcuts app to get my health data from my watch (calories burned, steps, etc.) and send it to my personal db for a dashboard
I use the following in Bash.

    function notifyme() {
       MSG=${1:-'Terminal is done'}
       TITLE=${2:-"Done!"}
       osascript -e "display notification \"${MSG}\" with title \"${TITLE}\""
    }
I use it like:

bin/start-unit-tests; notifyme

This is really nice!

Here is an attempt at fish port:

   function notifyme
     set MSG $argv[1] "Terminal is done"
     set TITLE $argv[2] "Done!"
     osascript -e "display notification \"$MSG[1]\" with title \"$TITLE[1]\""
   end

disclaimer: this is first fish function I ever write so might not be the best way to do default values; I'm using hack from https://unix.stackexchange.com/a/88682
Too late to edit, but was rereading this and i forgot that I made optional args too. For example i sometimes leave my self next instructions

   notifyme "Now you can commit and push code"
   notifyme "Now you can commit and push code" "Tests complete"
I do something similar, but it is networked so when a compile is done on my dev machine, my main desktop shows a notification using terminal-notifier.

It's very old and very hacky. There are probably apps that do this so much better.

  /Applications/terminal-notifier.app/Contents/MacOS/terminal-notifier -group not -title "$t" -subtitle "$st" -message "$m" -execute "$HOME/bin/gospace 1"
gospace ends up doing:

  osascript -e 'tell application "System Events" to key code 18 using option down'
which presses option-1 which switches to space 1
> or other services?

Automatic monthly purchases of low-cost index funds.

This way I don't have to worry (too much) about over-spending on other items as I've taken care of future-me.

Almost all of my personal automations actually make my life more difficult.
I have a cron job on my laptop that loads iptables rules that drop all outgoing packets except to work-related sites (chat, e-mail, issue tracker, code review, plus a handful of reference sites) during my work hours.
I used to have a Twilio phone number hooked up to a Lambda function so that people could press the buzzer box at the front of my apartment building and it would automatically send back the required DTMF to unlock it, then text me to let me know someone had been buzzed in.

Other than that, just some bespoke Tasker automations and some hotkeys on my computer. Reading through this thread makes me feel like a rookie, though.

I never found the perfect note taking and/or scheduling software. So I wrote a Python script which combines several tools which together give me what I need. My entire life revolves around it, can’t imagine living without it anymore.

Getting that sort of system sorted out is maybe the most productive thing you can do because it is meta-productive.

can you explain a bit more about this? sounds very interesting
Would you mind going into a little bit of details about the tools you use and how automation helps? I am very interested in this.
I would like to know too :)
a very simple cronjob which creates a ~/data symlink, that points to ~/works/data/$(date -u '+%Y-%m-%d')

why? I have to deal with a bunch of files at $job. easier when they're all at one place, and I have a clean slate everyday.

I automated my desktop environment configuration using Docker containers. I'm able to go from a headless tty to perfectly tailored desktop environment in ~2.5 seconds. First time start requires a ~40 min build, byut thereafter ~2.5s to start afresh. https://github.com/sabrehagen/desktop-environment

I did the same think for my production application environment. One command to go from no infrastructure to production grade cloud application deployment. https://github.com/cloud-computer/cloud-computer

Does this mean your entire desktop environment is a Docker container? Or are you using the docker container to setup on the host?
No, not on the host. The containers run on the host and provide the environment. They are isolated from the host.
I don’t mean to sound snarky, but why? Is this for your personal desktop or something else?
My personal desktop. For repeatability.
Aaah, that’s the dream! The best part of Linux workstation is setting it up perfectly, in a way that completely blows away everything else on your personal workflows. And the worst part is doing it again.

I use mostly macOS now but I’ve been thinking about using my desktop for work now that WFH and all that, so I need to embark on the Linux journey and this looks like a great starting point.

I did try Nix once but it was hard to love.

Edit: and hey you package Notion :)

I have done this[0] to varying extents for different distros, though I've been distrohopping a lot lately and the scripts haven't quite caught up. I have a similar set of scripts used to provision workstations and servers in my lab.

I find that having a fully automated setup makes tech problems much less stressful. If something breaks, I can just re-install the system from scratch and be up and running again in an hour or two. It also makes changing hard drives or setting up a new machines very straightforward.

0 - https://git.sr.ht/~charles/provisioning

This is really cool, thanks for sharing. Very elegant.
That's remarkable! I don't think I've seen anyone else even try to run X itself in docker. Thanks for sharing:)
I've found that paying people to provide you with good food saves tonnes of time: shopping, prepping, cooking, cleaning, garbage. Hotel buffet breakfasts or similar are a good solution. This is by far the most time efficient daily hack. Also good are floor cleaning robots. Not owning a car is great too, if you add up all the time doing parking/registration/license/insurance/whatever. Software... well, mostly just avoid closed source stuff where oodles of invested time winds up wasted when they arbitrarily mothball the product, close the cloud or deeply alter the interface without consultation. Keep documentation with code. Keep all code in a revision control system. Oh, and write less code. The less code you have to maintain, the better.
Do you just never cook for yourself? What service/method do you use?

I would love to reduce my cooking to weekends/whenever I feel like it, but I've had a really hard time finding a cheap, healthy, and sustainable way to do this. I always feel like I'm paying a more money to eat something that's not that great for me and tearing through gas/one-time-use plastics doing so.

Often cook, love cooking but don't cook every day. Most days if a meal is consumed at home it's either cold (salads, something with-or-on bread), really quick (soups), or zero-prep (fruit or nuts).

Breakfast is usually at a nearby hotel which covers 2/3 daily meals and associated coffee. Got a deal going so executable at less than walk-in expense, with zero lock-in (turn up or nay), transferable so also good for meetings on occasion. Heaps of fresh fruit, bit of protein, veg, coffee. Would be hard to match for cost let alone time at home.

My view is to look at quality food like insurance and invest in your health, or do the maths on the time. It's worth it.

May be you should keep a watch at https://whatscookin.us.

Its a community meal sharing app. They are almost in production. I was a contributor there sometime back.

I could see money, but how much time are you spending on registration/license/insurance? Registration is 5 mins a year paying online, license is in person every 15 years and online every 5. Insurance is just a bill I pay. Perhaps it's more work in other states?
I found that finding a restaurant, going there, ordering, waiting, eating, paying and returning home consumes more time than cooking at home.
I got sick of opening the same tmux/terminal format every time I had to restart, so I wrote this:

    #!/bin/bash
    
    function command() {
            CMD="$1"
            xdotool type "$1"
            xdotool key Return
    }
    
    function key() {
            KEY="$1"
            xdotool key $KEY
    }
    
    function clear() {
            for n in {1..10}; do
                    key BackSpace
            done
    }
    
    function name_panel() {
            NAME="$1"
            key ctrl+a
            key comma
            clear
            command $NAME
    }
    
    name_panel 'cmd'
    
    key ctrl+a
    key c
    name_panel 'srv'
    
    key ctrl+a
    key c
    name_panel 'make'
    
    key ctrl+a
    key n
    
    echo "Now type ssh-add to log in..."
    ssh-agent bash
I feel like I should point out that tmux is quite happy to take commands directly on the command line: `tmux new-window -n srv` will make a new window named "srv", `tmux next-window` will move you forward one window, etc. Hit prefix-? to list the commands bound to each key when you're running.
Thanks! I had this strange feeling someone was going to tell me something exactly like this after I posted. I'm glad I did though, it's good to learn new things.
:)

Remember, just because someone tells you a better doesn't mean there was anything wrong with your way (if nothing else, sending actual keystrokes is a universal-ish API rather than having to learn each program's specific interface, if they even have one). But yeah, knowledge-sharing is a perk of these threads, too:)

    [ $1 ] || { echo "Notify what?"; exit; }

    curl -X "POST" "https://push.techulus.com/api/v1/notify/$PUSHKEY" \
         -H 'Content-Type: application/json; charset=utf-8' \
         -d $'{ "title": "Linux",   "body": "'$1'" }'
     
    echo;

I use this app[1] that notifies my cellphone, so I wrote this bash script that I call when a long task is done, so it notify me when I'm away.

1 - https://push.techulus.com/

Ring has been a fun! One of my holiday todo's is to finally sit down and program the IFTTT integration for my Amazon plugs to turn my garden lights on when my Ring Doorbell detects motion.

If you have someone you'd like to get interested in IoT and/or programming, it's probably the best feedback loop between effort and reward you can find -- up there with learning to program HTML/CSS/JavaScript and refreshing a web app on local