Mailing List

Flat
A cool application of Fuse
User: chrisdolan
Date: 1/23/2008 0:12 am
Views: 826
Rating: 0
These days, I get excited when anyone does something cool with Fuse.  
It's even better when they do something in Perl with Fuse!  This  
person built a caching network drive proxy to enable offline music  
consumption -- in just 227 lines of code.

   http://use.perl.org/~awwaiid/journal/35454

Chris

Re: A cool application of Fuse
User: afbach
Date: 1/25/2008 9:10 pm
Views: 0
Rating: 0
Slick - the guy's got some good ideas - one he takes 'log this' shell script (named 'L' as in:
$ L just got into work
$ L the server went down again
$ L dont forget to go to the store tonight
he's a consultant, so the logs can be used for billing etc.)
#!/bin/sh

if [ -n "$*" ]
then
echo "`date '+%Y%m%d%H%M%S'` $*" >> ~/tlt/private/log/LOG-$HOSTNAME
else
(for i in ~/tlt/private/log/LOG-* ; do tail -20 $i ; done) | sort | tail -20 | perl -pe 's/^(....)(..)(..)(..)(..)(..)/$1.$2.$3 $4:$5/'
fi

and w/ the help of Net::Google::Calendar

#!/usr/bin/perl

use strict;
use Net::Google::Calendar;
use Net::Google::Calendar::Entry;

my $host = `hostname`;
chop $host;

if(@ARGV) {
my $text = "@ARGV";

# First we add it to the local LOG file
my $ts = `date '+%Y%m%d%H%M%S'`;
chop $ts;
`echo "$ts $text" >> ~/tlt/private/log/LOG-$host`;

# Now lets add it to the google calendar
my $username = 'awwaiid@gmail.com';
my $password = 'awwaiidxxx';

my $cal = Net::Google::Calendar->new;
unless($cal->login($username, $password)) {
print "Error: $@\n";
die;
}

# Gotta select the 'Notes' calendar
for ($cal->get_calendars) {
$cal->set_calendar($_) if ($_->title eq 'Notes');
}

# Set up the entry
my $entry = Net::Google::Calendar::Entry->new();
$entry->title($text);
$entry->location($host);
$entry->transparency('transparent');
$entry->when(DateTime->now,
DateTime->now() + DateTime::Duration->new( minutes => 1 ) );

# And finally, add it
$cal->add_entry($entry);

} else {

print `(for i in ~/tlt/private/log/LOG-* ; do tail -20 \$i ; done) | sort | tail -20 | perl -pe 's/^(....)(..)(..)(..)(..)(..)/\$1.\$2.\$3 \$4:\$5/'`;

}

make its an Internet calendering op.

a
PreviousNext
Madison Area Perl Mongers