W3C home > Mailing lists > Public > public-rdf-ruby@w3.org > March 2011

element shell integration

From: carmen <_@whats-your.name>
Date: Wed, 2 Mar 2011 16:08:12 +0000
To: public-rdf-ruby@w3.org
Message-ID: <20110302160812.GA7953@11.Belkin>
ultimately i want as much of element as URI-named functions .  managed to get sh PATH namespace usage down to two symbols, to be named at your discretion. i use e and E

originally was defining aliases for each function i wanted to call. switched to a selector approach. 

e maps to instance methods
E maps to class methods

URI-named functions can be called via :y method on e (could curry an alias)

=> #<Proc:0x88a3c68@/usr/lib/ruby/site_ruby/1.9.1/element/W/cal.rb:3 (lambda)>
=> "2011/03/02"

=> [/m/2011/03/02/msg.CDsB, /m/2011/03/02/msg.DDsB, /m/2011/03/02/msg.EDsB, /m/2011/03/02/msg.FDsB]

11 local e day y

11 local e "/m/2011/03/02/*" glob | head -n 3

11 ix e /.mail/2011/03/02/msg.EDsB r | tail -n 12
Didn't you ever have this weird feeling of meeting a fellow musician
who's on Linux too, when you suddenly realize you talk about tools,
setups, bloody kernels and suchlike and somehow actual music is never
mentioned? It's a trap :)

Alexandre Prokoudine

in cron, on my phone i have this little script

rsync -avz .mail f:
rsync -avz .mail s:
cd web
e /m ml
E feeds

it grabs my mail, and since ~/.getmail/getmailrc contains

type = MDA_external
path = /usr/bin/procmail

 its sent along thru

cat ~/.procmailrc
D=$HOME/.mail/`date +%Y/%m/%d`
MKDIR=`test -d $D || mkdir -p $D`

added to a dir named via date, matching our strftime(3) above

it tries syncing the new files to both my netbook and a wireless router if theyre in range( about 350 mb a year  of messages with all the MLs im on)

next it cd's to webserver root, runs a command which brings up ruby to keyword and create sioc indexes in a filesystem t-store

E feeds is described at http://blog.whats-your.name/post/2010/10/25/aint-no-winer

supposing i decided to rm -rf a netbook, install a new OS or whatever,  reindex all the messages in irb:
E['/m/20*/*/{01..31}/*'].glob.map &:indexMail

/m is a totally arbitrary path i symlinked ~/.mail into server root

supposing i want today's dir 

11 ix e /m day

or from a web agent

11 ~ curl -I http://f/m?y=day
HTTP/1.1 303 See Other
Location: /m/2011/03/02/*?

i'd add something like view=threads to the querystring

a webserver has to be running for that to work!

11 ix E daemon
[2011-03-02 15:37:12] INFO  WEBrick 1.3.1
[2011-03-02 15:37:12] INFO  ruby 1.9.2 (2011-02-18) [i686-linux]
[2011-03-02 15:37:12] INFO  WEBrick::HTTPServer#start: pid=7759 port=9292

yeah, webrick is really ancient, we can do better

11 ix E daemon -s thin -p 80
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on, CTRL+C to stop

options are in
rackup --help

didnt want config.ru files littering my disks which is why hooked this up, but you can in sh:
echo run E > config.ru

then they will work

thin -r element/Th --threaded --no-epoll -p 80 start -R config.ru

we can generate serializations from commandline. the one below invokes RDF.rb 

11 local e /m/2011/03/02/msg.EDsB serialize text/ntriples
</m/2011/03/02/msg.EDsB> <fs:size> "5598"^^<http://www.w3.org/2001/XMLSchema#integer> .
</m/2011/03/02/msg.EDsB> <fs:mtime> "00:51:22GMT"^^<http://www.w3.org/2001/XMLSchema#time> .
<AANLkTika7ucGCniwoYNZv3FA_S6s6461oBYwiqVi_YoN@mail.gmail.com> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://rdfs.org/sioc/types#MailMessage> .
<AANLkTika7ucGCniwoYNZv3FA_S6s6461oBYwiqVi_YoN@mail.gmail.com> <http://rdfs.org/sioc/ns#content> "On 3/2/11, S C Rigler wrote:\n\n&gt;&gt;&gt; I was thinking the same thing until I started having flashbacks to the\n&gt;&gt;&gt; days\n&gt;&gt;&gt; of the browser wars when every web site said \"Made for Netscape\".\n&gt;&gt;\n&gt;&gt; \"Made for\" is something different than \"made with\" ;)\n&gt;\n&gt; I know...the only one that came to mind was \"Made with FrontPage\"...\n&gt;\n&gt; Maybe somebody could invest the time and money into a \"Linux Only\" record\n&gt; label.\n\nA flashback for that one is \"For programmers by programmers\" :)\n\nPeople have been hearing about \"Linux on desktop\" since forever. This\nis simply not interesting. The best OS is the one you don't notice.\nJust don't mention Linux at all, give a little more accent on content\nrather than tools and it might get you further than you expect.\n\nDidn't you ever have this weird feeling of meeting a fellow musician\nwho's on

to be redirected to a file served by a webserver to tabulator or so..

that's the general concept anyways

Received on Wednesday, 2 March 2011 16:09:12 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 19:53:41 UTC