Skip to content

Instantly share code, notes, and snippets.

@atog
Created April 26, 2017 21:48

Revisions

  1. atog created this gist Apr 26, 2017.
    23 changes: 23 additions & 0 deletions find_inactive.rb
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    # install the 't' gem: httjp://sferik.github.io/t/
    # set the path to the executable

    t_cmd = '~/.rbenv/shims/t'

    followings = `#{t_cmd} followings`.split /\s/
    whois_cmd = "#{t_cmd} whois "

    activity = {}

    followings.each do |f|
    info = `#{whois_cmd} #{f}`
    last_active = {f => info.match(/Last update.*\((.*)\)/).captures.first}
    activity.merge! last_active
    end

    years = activity.select {|k,v| v =~ /years/}
    months = activity.select {|k,v| v =~ /months/}
    months = months.select {|k,v| v[0,2].to_i > 3}
    all_inactive = years.merge(months)

    # run t unfollow {output from the command below}
    puts all_inactive.keys.join(' ')