Any api to purge old deleted posts / uploads

Call for Help!

Can a clever person walk me through combining:

AND

to make an awesome orphaned uploads purger run from the console?

I note that when I use rails db, I’m asked for Password for user discourse:. What do I do with that?