Ask HN: What do you automate in your life and work?

244 points by gcj ↗ HN
Just curious about scripts and things you guys have automated

199 comments

[ 3.7 ms ] story [ 242 ms ] thread
I live in a condo complex with a dog and no lawn. We learned after getting our dog that this place doesn’t want dogs going to the bathroom on any of the common area (makes sense but annoying to dog owners). We used to get a small patch of grass delivered every week but it was a hassle to swap each time. Also it was disgusting by the end of the week. Then I discovered porch potty. Got the version that is hooked up with a sprinkler system and a drain. Set up an auto timer so it gets completely flushed every night. Saves us a bunch of money and time. Highly recommend. https://www.porchpotty.com/
> We used to get a small patch of grass delivered every week

haha, WHAT??

Could make some song lyrics out of that, am I right, Ol’ Wheeler?
Sod-as-a-Service (SaaS)
This has to be the most pointless and wasteful thing I read about all week.
Care to suggest a better solution?
There are plenty of other ways to do this, but...

I have a CC specifically for reoccurring bills. It’s automatically paid off every month and just by looking at that one debit it’s easy to notice if something odd happens and then track down what changed. Plus by adding it all together I tend to trim what services I keep paying for.

Your bank has an API for that?
You don't need an API. Most bills can be put on a CC. Most banks have automatic bill pay. Having all the recurring bills on one CC is the life hack b/c it's very easy to see in the total each month if something requires investigation.
Not exactly a script, but if I really think about it the largest thing I've automated in my life is investing--- via index funds. No picking individual stocks, no rebalancing (Vanguard and others have "target date" funds that rebalance automatically).
Don’t you just end up with a portfolio weighted with half below average stocks? Seems like you could beat this just by buying stuff you’ve heard of. I’m sitting her with my Apple phone, using Verizon internet, burning electricity from a publicly traded utility that probably won’t go broke next week, wearing my Nike shoes and drinking a Coke. That portfolio probably beats your index and requires zero brains or effort.
Every time you buy your stocks for those individual companies you're accruing fees. You're also extremely susceptible to sudden loss due to lack of diversity. And even if you had the time, energy and knowledge to pick what you think is the best half of the Russell 3000, you still wouldn't beat the index - https://www.fool.com/investing/2018/01/03/warren-buffett-jus...
The problem isn't always knowing what to buy, but when to sell. For some who don't have the time of researching and rebalancing an index fund or ETF that does it for you is a good value prop.

Example where that strategy might run into problems - hindsight is 20/20: https://pbs.twimg.com/media/EH6la6VWoAIC0cM?format=jpg&name=...

Index funds don't try to time the market. Which ETFs are you thinking about? Hedge funds?
It does not. If it was that simple, there wouldn't be an entire trillion dollar industry based on it.
The problem is there's no way for you to pick the winners and losers accurately. Most people who spend their whole career picking stocks actually don't beat the market indices. It's not as trivial a problem as you seem to think it is.
Over the past 5 years, Nike has gone up by 100%, coke by 20%, Verizon by 15%, and apple by ~125%. The s&p500 has gone up by ~50%.

So if you invested 100 in an index fund, you'd have 150, if you invested 100 split evenly in those 4 stocks, you'd have 165. Of course, if you invested in GE, you'd have lost money. And if you invested in Amazon alone, you'd have $500.

This analysis is flawed in two respects: 1. It neglects dividends. 2. The S&P 500 as presently constituted omits all the companies that were excluded during that time period (eg., went broke).

If you just buy good solid companies that pay dividends, you do ok.

> If you just buy good solid companies that pay dividends, you do ok.

What are the good, solid companies 10 years from now? 20 years? When should I dump my current good, solid companies?

Echoing this, the median amount of time a given S&P500 sits in the S&P500 is less than 20 years. This becomes a tricky problem.
> 1. It neglects dividends.

True, but if I replaced S&P500 with VTSMX (a Vanguard index fund, which got marginally higher than 50% returns over the same time period) would not.

> 2. The S&P 500 as presently constituted omits all the companies that were excluded during that time period (eg., went broke).

The current S&P 500 does, but watching the S&P500 index over time does not. And index funds generally rebalance to take these things into account.

As another user mentioned: knowing which companies are "good solid companies" is a trillion dollar industry. No simple strategy beats the market over the long term, other wise passive investors would all do it, and start beating the market.

If I recall, target date funds have taken quite a bit of flack for their fee-adjusted performance compared to a minimalist simple 2 or 3 fund fund portfolio approach.
This is the smallest thing that will have the biggest impact on your life significantly decades from now. I like phrase "pay yourself first".
Back when Tinder's API was more open, I had a Python script that would autoswipe everyone in the match queue. Then I'd go through all my matches, manually filter the ones I didn't like, and message the ones I did.

It was highly efficient, increased my conversation rate, but didn't really impact my end metrics ;)

You can pay for Tinder Gold and Boosts, which effectively does the same thing but for money
There was a hilarious article a few years back about someone who automated every part of the dating process, including the actual dating using a bot on a segway and automatically ordering sex toys. Anyone know what I'm talking about?
I have a list of questions that I like to be thinking about and have an automated system that texts me one of those questions at random during my waking hours.
I use IFTTT to do a few things like this.

Mostly motivational sort of stuff.

I like this idea of asking myself questions.

Yeah, I used to email myself my core life principles, but it felt like unsolicited advice even when it came from me. Questions on the other hand are mostly engaging especially when you don’t know what it’s going to be.
I like that idea of questions.

I do have one that says something like make a list, writer out 2 or 3 things and do them.

I use cron to send myself birthday reminder emails:

  0 0 9 11 *      /usr/bin/mail -s "REMINDER: Nov 9 is Marks birthday" me@mydomain.com
Or just annual reminders or warnings I want to heed:

  0 0 1 8 *       /usr/bin/mail -s "REMINDER: MAKE christmas St. Francis reservations NOW for good pricing..." me@mydomain.com
Sometimes, instead of /usr/bin/mail, I use 'smsme' which is a small script that interfaces with twilio:

  /usr/local/bin/curl -X POST -d "Body=$msg" -d "From=$from" -d "To=$to" "https://api.twilio.com/2010-04-01/Accounts/$accountsid/Messages" -u "$accountsid:$authtoken"
(that's not the entire script, but you get the idea)
What’s wrong with reminder apps that are default with all smart phones?
I've been building this crontab since 1996.

How many phones have you gone through since 1996 ?

Notifications/interruptions don't tend to be at a good time and get swiped away, if you get an email you can check it at an actionable time, assuming you disable email interuptions.

It's easy to keep in git along with other configs so it survives phone refreshes without relying on third parties who are probably snooping on that data.

Phone apps and phones themselves are temporary, not suitable for this timescale of things.
1. I wrote a cron job to auto commit my code to their repos if I haven’t edited a file in 12 hours.

2. I started a while business getting news emails on more niche topics (works better than other services IMO): https://lettergram.net/

3. Automated emails sent to customers thanking them for feedback.

4. Important emails are texted to me (as determined by my classifier)

How does 1 cope with branches? Also, do you never e.g. leave a piece of code commented out for a couple of days whilst fixing a related bug in a different file?
It’s what ever active branch I’m on. I do a branch per feature / issue, then merge to master. Not really a problem.

I also have all critical stuff setup to auto deploy after tests.

I’m a one man shop, everything has to be automated or I don’t have enough time lol

I've used Automate App (https://play.google.com/store/apps/details?id=com.llamalab.a...) to set my android phone to silent mode in office and loud at home based on the wifi ssid.
That Google/Android tracks everywhere I go, sends me an email at the end of the month about it, and still can't silent/remind when I get into proximity of a location bugs the shit out of me.

That tracking that's so profitable for them is an afterthought when it comes to my own convenience.

I mean, Google Assistant absolutely supports location reminders. Just ask "remind me <x> when I get to work" and it'll... mostly work. Sometimes it's a bit late, but it mostly works. For silent, I think that'd be more of a Tasker/Automate thing, like OP.
Oh! I did not know that Google Assistant can do that. Thanks a lot. Will try it for sure. #TIL
Makes sense I missed it then, I hate using the assistant. It feels like asking someone else to scratch my nose.
For those on iOS, built-in Shortcuts app can do this as well.
I’ll checkout automate.. have used Tasker in the past.
My typing. In my work I tend to type a lot of the same things over and over again. So I automate that with AutoHotKey. Ctrl+Tab becomes RightAlt. Two words become entire paragraphs. Even simple things like "You're welcome" are just 'ywyw' or 'tyvm' becomes "Thank you very much". I know it sounds silly, but while trying to avoid RSI's, the less typing the better.

I also use autohotkey to help me remember to Linux commands that I don't remember of are awkward to type. Like 'awk1' becomes "awk '{print $1 }'" and then I can modify it as needed.

This has worked extremely well for me for many years. Ymmv.

Autohotkey doesn’t get enough attention. Great software.
I wonder if it would be possible to build an app that's effectively a self-installed keylogger given access to your entire stream of writing, and after a few days, it starts to recommend candidate strings for automation with Autohotkey.
This was the idea behind the Blackberry Android keyboard.

Source: Was there, wrote code for it.

sounds like code that could be useful to this day at least the concepts. That's the downside of closed source. It's gone now.
I think it could. It could log words for a certain amount of time, give a list of recommendations, and export it as a AutoHotkey file.

It would be a neat project at the very least.

Are you using wsl because AutoHotkey doesn't work on Linux...

Back when I was on Windows I used to have ctrl-c, ctrl-v mapped to F1 and F2 keys (using AHK). Why they don't have dedicated keys I don't know

I'm on Windows 10. When I'm using it in Linux, it's via SSH through Mobaxterm, which is a fantastic and free Windows shell manager.
are you using it for remotely accessing linux boxes? mintty+wsl-bridge aka wsltty has really come a long way in a short time, and i'm beginning to use it even for remote work alongside using it for wsl. call me shallow but it really boils down to it looking far, far better when staring at a vim buffer for hours...

i absolutely love mobaxterm, but there's alot of cases where it seems like overkill for my purposes. that being said, nothing beats mobax when it comes to a stupid easy X server for windows. vcxserv and x410 are both nice and getting nicer, but you gotta sit down and work out kinks to make either one really useful

Yup, logging into web servers at work. I haven't messed with WSL much except for having a local Linux environment for local work. I have a home server for anything more serious than that such as hard drive recoveries and the like. I discovered Mobaxterm some years back and have stuck with it. It really is nice. While it may be overkill, I've had to do things like open up RDP on multiple boxes and wow... it Just Works. It's a hidden gem.
mobaxterm helped me get serious about security when i ran the ssh server once and used the easy menu options to view who was knocking on my doors, and... man. people think the robocallers are persistent...

i did a little screenshot ( https://i.imgur.com/HndJDqg.png ) to demonstrate how far WSL has come - though i must admit i am using the paid ($10) 'pengwin/wlinux' distro that was built specifically for WSL, basically debian with some tweaks and a config menu not unlike the 'raspi-config' menu on an RPi. i would say that it has absolutely been worth it though. it will be some time before being able to install something from a debian repository, and then open it from my windows start menu, ceases to just leave me in awe.

(comment deleted)
I have a website that tells me when the next train leaves and if I need an umbrella: http://mazu.ai/

Probably a good idea for a startup actually, a 90s style "web portal" for urban commuters that tells you the weather, transit situation, and downloads some news articles for when you're in the tunnel.

I have a pretty good system for knowing if I need an umbrella! If I forget it at home, it always rains!

That is very cool!

Cfcxvvxvxbxbxsvdfvbxgbrf
Report generation that need to be done through some poorly designed web frontend (even to a point where you abstract the automation process and the return of the data as an api). Have been worked at various companies over the past decade, I found that this kind of automation is the most valuable.
Ghhcnfcrbggbhfjjfjxhgnjf
Nothing fancy or involved at all, but in my personal finance spreadsheet, I dynamically pull in Zillow's current estimate of my home value (which I take with a grain of salt obviously).

I also use IFTTT to pause my robovac if my doorbell rings.

Right now I'm working on a Mint scraper to automate the rest of my personal finance data entry, but running into headaches getting Selenium to work properly on Catalina.

There appears to already be a mint scraper on github
Can you share a link? My understanding is the one I've found available pulls in transaction data. I actually don't care about transaction data at all. I explicitly just want monthly account balances (including what historic months closed at), and some of the net worth and net income summaries. Nothing I've found yet offers that.
Do you need to scrape Mint when it's just using Plaid?
My understanding from Plaid's somewhat confusing docs is that the Free tier gives transaction and balance data from cash accounts, but I need it from all of my asset accounts, which you seem to need to be on the $500/mo plan for. Since this is just for personal use, I can't really justify that.

All I care about is monthly account balances and month ending amounts for historic months for ALL accounts (cash, assets, debt) and then the net worth and net income monthly stats.

If I understand Plaid's pricing correctly, it's $500/mo to get what I want but I could be misunderstanding their docs. Would love to be told I'm wrong!

I wish I could help, but it sounds like I misread in the other direction! I have not actually tried it out, it's on my list of todos. Good luck!
I think you're wrong (yay!) about plaid's pricing.

My startup uses them, and we are very low volume, and we pay $1.50 for an auth and $0.30 / month for each active account we pull transactions from. Getting balance costs $0.10 / call though.

We signed up probably about 6 months ago.

Oh wow--is this the Pay as you Go plan? And is this the same whether the account is a checking account vs. an investment account (ie. Assets product)?

Also, while this gets me net worth through math, I'm not quite sure if it gets me my monthly expense totals in summary format. Is it all raw transaction data I'd have to pull and do math on? Or is it trivial to pull the equivalent of monthly Mint summaries for net income and such via Plaid?

My job is to advertise on classified ads my local business: heard of OLX? I have macros in JavaScript that does that automatically (I only have to sit and write the captcha)
Hire a cleaner once every 10-11 days to clean my apartment and do the laundry. Its surprising how much time you have if you don’t have to do dishes.
My house is a mess after a week. How’d you come up with 10-11 days?
Thats when he finally runs out of dishes.
mine after a day, with a toddler around. And 10+ old days dishes smell as hell. No thanks, I do dishes as soon as I can, because hygiene first
What's the pricing like for something like this? Do you use a large service for this?
How do you not do the dishes for 10+ days?

That said, my wife and I do the same thing. Plus have a Roomba. All told it means everything stays clean and we're only on the hook for laundry.

The cleaners probably all draw straws to see who has to go to the house with the 10 day old dishes in the sink.
I had trouble getting a DMV appointment. Wrote a script that would alert when one was available. The site wasn't busy enough to warrant building out the booking. Only used the script once.
I use a 20 line Python script to convert Outlook .ics calendars into billable hour count. It looks for a company name (the client) and calculates start and end time. All it needs now is to fill a .pdf invoice template and I can get rid of HR :D
Use DocAssemble... it has an API and can fill PDF templates.
Shameless plug: I’m working on FormAPI [1], which can help you set up the PDF invoice template. We provide a Python client library, so you can add that to your script with a few lines of code.

[1] https://FormAPI.io

I automate my garden. In the summer I have it configured with an automatic drop. I still get to play in my garden and there's always more annual maintenance to do, but the general watering and care is easily automated with a drip timer from home depot.
Any tips on automating watering herbs in a small apartment?
Lots of home automation fun with Home Assistant (https://www.home-assistant.io)

* Self-hosted security system that e-mails me when triggered. It arms when everyone disconnects from the wifi and disarms when anyone in the home reconnects to wifi. Totally passive. Also arms at night when the kitchen lights have been out for 5 minutes after a certain time and disarms when motion patterns that can only be someone waking up are sensed.

* E-mails work and personal when smoke alarm goes off or when water is detected in basement

* E-mails pic from front door camera when doorbell pressed (yeah, like Ring, but with a ESP8266 monitoring my normal doorbell)

* Voice reminder on garbage day

* Northern loon call exactly at each sunset

* Ambient jungle noises and lights on when I wake up and it sees me

* Laundry timer + reminders

* Vacation mode random lights on/off

* Plays a Ship's bell chime on the hour, but only during daytime (ambiance)

* Tones when any outside door in the house opens. Optionally: random Seinfeld bass transitions

* Alert for power outage

* Alert if my mom's house temperature goes too low in winter when she's away (I've called the plumber to fix the furnace thanks to this)

* Turn on A/C if temperature above threshold at 4:00pm in anticipation of my return from work

Stuff like that. Loads of fun. Lots of fiddling.

Wow that is really impressive. Home assistant is something I’ve been meaning to get in to for a while, but the amount of time it seems like it would take to set all that up and maintain it seems daunting. Sounds fun though!
The nice thing is, you can start small. Thats how everyone does it really, just add one thing at a time, most of which is fairly simple. Just some hue motion sensors and lights can make for some nice automations.

I used Home Assistant to graph my pool temp, and control my pump so that I made most use out of our solar heaters.

Could you recommend some resources to get skilled with such suff? Also what tech stack you are using? (both hardware and software)
Hardware:

* Raspberry Pi (I've since moved to a Ubuntu server, but Pi was perfectly capable on this entire setup)

* Aeotech Z-wave z-stick (for controlling the wireless sensors)

* Lots of z-wave sensors (door, motion, temperature, humidity, flood, one that listens for my smoke alarms going off, a whole house power sensor in the circuit breaker box, ...)

* Lots of z-wave switches (some where I replaced light switches with smart switches, others where I just piggied a z-wave relay between the wall and the thing)

* A few Phillips HUE lights for fun color BS

* an old 433 MHz temperature sensor that the previous tenant left without the weather station (read through a $5 USB TV receiver)

* Another Raspberry pi sitting on my stereo hooked to Snapcast to pipe synchronized wifi audio throughout the house from a single source.

* Mopidy as the central music server to pipe stuff through Snapcast

* OpenWRT router running some scripts for presence detection

* Cellphones via web interface for control

* Also a fun little LED dot-matrix display for fun displays

* A few Amcrest IP cameras (with cloud crap disabled)

Software is very Home Assistant heavy, with lots of little auxiliary scripts, some home-built, many others from other enthusiasts. The central community is the Home Assistant crew. But also:

* MQTT on a remote MQTT broker ($5 VPS) for communicating with external devices (like my mom's house and my cellphone when off-site)

* Owntracks for GPS-driven automations

* Self-hosted e-mail (totally unnecessary, just a hobby)

I think that's about it.

For getting started, yeah just start small. Get a z-wave usb stick and a pi and a few little sensors. Hook it up to your stereo and wifi and start fiddling based on the examples from home-assistants forum and docs. Then it just slowly bootstraps up to something elaborate, if you're enjoying it.

Interesting, although I don't have the amount of time required to do these things.
It's definieltely a hobby thing. I have time for it because I choose to set aside other stuff for it.

Once it was all set up it just runs itself with little tweaks and additions one a month.

Sounds great. So do you need one raspberry pi per automation ? Or are you somehow linking all these diverse processes with one raspberry pi ?
One raspberry pi for all! The devices are connected via zwave wireless with a USB stick zwave controller. Actually I moved the main server from a pi to my home server a while ago but it was all working fine on a pi 3.
> Ambient jungle noises

I like this.

Do you have a power adapter for the doorbell monitoring ESP?
It is powered from the same circuit that powers the doorbell chime coils.
Can you elaborate on the doorbell? Also where do you host your Home Assistant setup?
I hosted Home Assistant on a Pi2+ at first, and then Pi3 for a long time. Eventually I wanted to use the Pi3 for something slightly different and had a low-powered home server at that point so I migrated to that. It's basically just running on a Ubuntu box that I use for NAS and workstation stuff now.

As for Doorbell, it's pretty much like this: https://partofthething.com/thoughts/making-my-analog-doorbel...

> Tones when any outside door in the house opens. Optionally: random Seinfeld bass transitions

Dear Lord yes, that is FUN! I'd love to see 'walk up music' like in MLB, but for anyone and changing randomly from time to time.

I like the your ambient noise approach. What are you using for sounds do you have your config online?

I am looking to make my house more reactive as well. One area where HA has been a godsend was integration with TV/Music/idle off. Whereas there wasn't one solution which would shut off the TV and stereo in my set up once they were in Harmony Hub I could add idle timeouts for them in HA.

Another was theater lighting when the TV starts. In the theme of ambience I am looking at switching the lights to something more colorful when paused.

Minor stuff. Any logins that require password (git/ssh), all the command line operations that I do more than one time (I start with moving them to text file and when it gets tedious - to shell scripts, saves surprising lots of time).
I use automatic bill pay and some scripts to fix video player settings, that's about it for full automation.

A lot of things are semi-automated, as in I have a script / specialized software to handle them, but I still run them by hand. I have a paperweight suitable for holding down the enter key which comes in handy sometimes.

I use the repeating events feature in Google Calendar a lot, that seems to mystify people who think I put them all in by hand.

The automation people seem to fall into a few camps: smart home, enterprise data, and vacation. The last is referring to the sort of people who build a business, hire some low-paid folks to do all the work "automatically", and take a vacation. This seems like cheating to me but whatever.

Just in case you might not be aware (this has caught me out):

Google Calendar repeating events has no way to set up a "repeat every x" (day,week,month,etc..) forever. It will stop after something like 1 year with no warning.

I use it for an important daily email reminder, and did not notice it had stopped until a day or two after.

I automate most things I do more than a dozen times.

Marketing for my wife's uncle was a pain, so we automated CL and FB posts to fire from Quickbooks Inventory on a schedule.

I'm full-time remote, so I have a spreadsheet that tracks my expenses from a google form, does currency conversions for my location and forex analysis to tell me the best day to pull money from an ATM, tells me how much I have to spend on food each morning...

There's a script I send quotes I like to, and it randomly sends me one from the list via Telegram every day at 6am.

I'm also a swing-trader who hates staring at charts, so my watchlist generates via news and sentiment, then I run TA on that watchlist to send me alerts if a signal is generated, then all I have to do is hit buy/sell on my inline keyboard and it sends off a market order; it auto-exits after a target or stop loss is hit.

Recently formed an agency with a few other automation devs who do similar stuff if you want to check it out: https://weautomatestuff.com

I would love to hear more about your trading scripts and your TA assessment. Which API do you use?
I write custom scripts for strategies, pulling data from places like Alpaca, IB, CCXT; charting using bokeh, plotly, mpl and other repos; zipline for backtesting... It really depends on the need; and the speed.
> Recently formed an agency with a few other automation devs who do similar stuff if you want to check it out: https://weautomatestuff.com

Would love to hear more about the business side of this, because this sounds like the ideal side project for natural born tinkerers!

It may be too soon in the project's lifetime for any insights, but if there's any wisdom nugget you can share it would be really nice :)

I have a motion light at the bottom of the basement steps.

I also write scripts to compare OpenStreetMap to external datasets and surface interesting differences.

(comment deleted)