Net pipes for Pine

autarch on 2007-04-20T18:39:54

So I'm a freak, and I still use Pine for reading my email. Even weirder, I like to run Pine directly on the server in question, because it's way faster than using Imap. However, this is a little annoying when I want to look at some sort of attachment like a PDF or image, because I need to view it on the machine running my gui.

I wrote this little script to enable this, and it works well:

#!/usr/bin/perl

use strict; use warnings;

use File::Temp qw(tempfile);

my ( $fh, $filename ) = tempfile();

print $fh $_ while <>;

seek $fh, 0, 0;

my $remote_host = ( split / /, $ENV{SSH_CONNECTION} )[0]; system( 'scp', $filename, $remote_host . ':' . $filename ); system( 'ssh', $remote_host, 'DISPLAY=:0.0 gnome-open ' . $filename );


The fact that gnome-open just does the right thing makes this all very simple.

However, I just now realized that this won't work when I am connecting from a machine behind NAT. I think the trick might be to always connect to the remote machine with a reverse tunnel, and take advantage of that to make things work.


Offered without further comment

Aristotle on 2007-04-20T19:58:31

zssh.

Cute and disturbing

autarch on 2007-04-20T20:33:04

I remember using Zmodem way back when.

That doesn't quite do what my script does though. With my script, I can transfer the file and open the relevant viewer all in one command.
h

Re:Cute and disturbing

Aristotle on 2007-04-20T21:12:59

It should be possible to use the hook command to achieve that, though. I admit I don’t know if it can actually be done, as I’ve only ever kept zssh on file as an “if I ever need to do that” sort of thing.

It’s a blast from the past, aye?