sifting thru your IRC logs w/ examine
Par Carmen Lotek le lundi 14 février 2011, 22:41 - Lien permanent
sometimes i have "queries" like "find a project that i think Claudius linked to last week on #dataflow". in the past id use grep for this. grep is always a valid approach, one of my mantras is faster than grep, if easier to just pop up a terminal and grep, i'll end up doing that so it helps when determing YAGNI coefficients of new ideas
tapping on some names / attributes in a list may be faster than grep in some scenarios (like not having a console open..) so first converting logs to RDF:
r.scan(/(\d\d):(\d\d) \[[\s@]*([^\(\]]+)[^\]]*\] (.*)/){|m|
s=uri+'#'+(i+=1).to_s
yield s,'time',m[0]+m[1]
yield s,'chan',chan
yield s,Creator,m[2]
yield s,Content,m[3].hrefs
yield s,'hasLink',(m[3].match(/http:\//) ? 'true' : 'false')
yield s,'hasNum','true' if m[3].match(/\d/)} rescue nil
a standard triplestream
tripler. now some views,
fn 'view/chat/item',->r,e{ r[Content] &&
['<b>',r[Creator],'</b> ',r[Content],'<br>']}
fn 'view/chat/base',->d,e,c{
{_: :pre, style: 'margin-left:13em;white-space:pre-wrap',
c: c.()}}
the two seperate view is a convention mentioned
here /base views are an entire graph, /item a single resource. (document
& fragments)
so now we can add ?view=chat and logs are converted to HTML with clickable
llnks and so
view=e&ev=chat invokes examine and configures it to use
the chat view
to specify input we can use globs, just like a cat before grep..
autolog_path = "~/.i/$tag/%Y/%m/%d/$0.log";