Skip to content

Instantly share code, notes, and snippets.

@jim80net
Last active April 4, 2018 03:44
Show Gist options
  • Select an option

  • Save jim80net/f634be71b57f8b21c43ca00bc395061f to your computer and use it in GitHub Desktop.

Select an option

Save jim80net/f634be71b57f8b21c43ca00bc395061f to your computer and use it in GitHub Desktop.
oneliner: Print KBFS update history for any given top level folder
ruby -rjson -e 'a = JSON.parse File.read(".kbfs_update_history"); a["Updates"].each {|v| ops = v["Ops"].map {|op| op["Op"]}.select {|op| op !~ /gc|sync|resolution/ }.join("\n".ljust(53)); printf("Op: %s by %s on %s: %s\n", v["Revision"].to_s.ljust(4), v["Writer"].ljust(15), (v["Date"][0,19]), ops ) if ops !~ /^$/ }'
@jim80net
Copy link
Copy Markdown
Author

jim80net commented Apr 4, 2018

Example output

2018-04-03 20:23:07 ⌚ |ruby-2.4.1| Jim-Park-MacBook-Pro in /keybase/private/example
○ → ruby -rjson -e 'a = JSON.parse File.read(".kbfs_update_history"); a["Updates"].each {|v| ops = v["Ops"].map {|op| op["Op"]}.select {|op| op !~ /gc|sync|resolution/ }.join("\n".ljust(53)); printf("Op: %s by %s on %s: %s\n", v["Revision"].to_s.ljust(4), v["Writer"].ljust(15), (v["Date"][0,19]), ops ) if ops !~ /^$/ }' 
Op: 13   by jim80net        on 2018-03-29T16:17:17: create pexample.id_rsa (FILE)
Op: 15   by jim80net        on 2018-03-29T16:18:12: create example.id_rsa (FILE)
Op: 16   by jim80net        on 2018-03-29T16:18:17: rm pexample.id_rsa

Known issues

  • This prints all activity in a TLF. IDK of a way to determine where a file is in the directory structure
  • /keybase/private/me seems to include keybase git commits as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment