How to Track Favorites with Ruby

in #radiator7 years ago

Lately, I've been doing a lot of manual curation. But I like to use tools to assist me. Here is a way to periodically check up on favorite authors from the terminal.

First, we need one of our previous ruby scripts:

How to List Accounts Sorted by Newest Blog Entry

Next, create a file named favorites.txt containing your favorites, for example:

envisionva
arrowj
stan
raymonjohnstone
georgedonnelly
steemsmart
marcstevens
razvanelulmarin
proctologic
mughat
picokernel
fyrstikken
fyrst-witness
krnel
sws8964
rwl4
ontofractal
elyaque
scarlet-rain
contentjunkie
sykochica
xeroc
papa-pepper
poeticsnake
dotvoluntarily
bitcoinparadise
voteinterestpool
whatsup
klye
dantheman
ftlian
gomeravibz
kurtbeil
konti

Create a script named favorites.sh containing:

#!/bin/bash

ruby accounts_by_last_root_post.rb `cat favorites.txt`

This script will always list all favorites sorted by their latest root post. Now, all we need is a way to check the difference between subsequent execution so we only see the changes, call it latest-favorites.sh:

#!/bin/bash

./favorites.sh > latest_favorites.txt.1
diff latest_favorites.txt.1 latest_favorites.txt | grep "< " | cut -f 2 -d "<"
mv latest_favorites.txt.1 latest_favorites.txt

Remember to make them executable and make an empty file. Then run it:

$ chmod +x favorites.sh
$ chmod +x latest-favorites.sh
$ echo > latest_favorites.txt
$ ./latest-favorites.sh

The first time you run it, you'll see all of the posts from the default settings.

https://steemit.com/@klye, last root post: 2017-01-09 13:51:15 -0800
https://steemit.com/@xeroc, last root post: 2017-01-09 13:03:48 -0800
https://steemit.com/@papa-pepper, last root post: 2017-01-09 12:38:09 -0800
https://steemit.com/@elyaque, last root post: 2017-01-09 12:14:51 -0800
https://steemit.com/@ftlian, last root post: 2017-01-09 05:28:54 -0800
https://steemit.com/@krnel, last root post: 2017-01-08 17:00:06 -0800
https://steemit.com/@bitcoinparadise, last root post: 2017-01-09 02:31:21 -0800
https://steemit.com/@whatsup, last root post: 2017-01-08 22:41:33 -0800
https://steemit.com/@raymonjohnstone, last root post: 2017-01-08 22:11:09 -0800
https://steemit.com/@mughat, last root post: 2017-01-08 14:51:09 -0800
https://steemit.com/@fyrstikken, last root post: 2017-01-08 05:21:39 -0800
https://steemit.com/@razvanelulmarin, last root post: 2017-01-07 09:58:12 -0800
https://steemit.com/@voteinterestpool, last root post: 2017-01-06 23:38:18 -0800
https://steemit.com/@kurtbeil, last root post: 2017-01-06 15:18:00 -0800
https://steemit.com/@poeticsnake, last root post: 2017-01-06 14:02:15 -0800
https://steemit.com/@konti, last root post: 2017-01-06 03:32:12 -0800
https://steemit.com/@contentjunkie, last root post: 2017-01-05 19:35:30 -0800
https://steemit.com/@gomeravibz, last root post: 2017-01-04 18:05:09 -0800
https://steemit.com/@scarlet-rain, last root post: 2017-01-04 16:22:18 -0800
https://steemit.com/@ontofractal, last root post: 2017-01-04 09:44:42 -0800
https://steemit.com/@dantheman, last root post: 2017-01-01 17:03:24 -0800

Then wait a few hours and the second time you run it, you'll only see new posts, for example:

 https://steemit.com/@krnel, last root post: 2017-01-09 17:00:06 -0800

ruby

See my previous Ruby How To posts in: #radiator #ruby

Sort:  

This is good like right now, when there are no notification working LOL. Handy for the CLI nerd indeed. Thanks.

Yeah, I totally nerd out on the CLI. So much so, I use mosh to keep my terminal(s) open so I don't have to relog after my macbook wakes from sleep.