Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

2shortplanks (968)

2shortplanks
  (email not shown publicly)
http://2shortplanks.com/
AOL IM: trelane2sp (Add Buddy, Send Message)
Yahoo! ID: trelane2sp (Add User, Send Message)

Mark Fowler has never been the same since he was elected leader of the London Perl Mongers. The strain manifests itself mainly in releasing various [cpan.org] modules [cpan.org] to CPAN, giving talks [2shortplanks.com], and use of the Trelane nick on #london.pm for endless procrastination. Doctors are still seeking a cure.
Monday September 27, 2004
07:46 AM

Life hack

[ #21071 ]
At YAPC::Europe this year they had a section called life hacks where you show other people things from your ~/bin directory in the hope that someone else might find it interesting. I was too busy at the time to share mine, so I thought I'd post it here.

My all time killer script is the one that Tom Insam came up with after we discussed the problem for a while. Basically, we do all our work on a development server and we can ssh and samba mount the device. When I'm working locally on my laptop I can edit any file by typing "ec $filename" and it loads in my local editor (a Carbonized Emacs.) I wanted the same thing when I'm sshed in to the development box.

So Tom came up with the idea of writing a script that starts another ssh session to the dev box and tails a file on the dev machine. The ec script on the dev machine writes to the end of the file instead of starting a process. The local end of the new ssh tunnel gets the filename and then spawns a local process to edit the file with my local editor over samba. Sweet! Completely transparent.

Of course it's more complicated than that. Whole YAML data structures get written to the file, so in theory at a later date I can extend the script to do something more useful. And I no longer run it as a shell script, I've got a CamelBones application written that runs the script and tails the output.

I know it's a simple idea, but the simple ideas are normally the best. It means I don't have to use a X11 forwarded editor from the dev server (eeek) nor do I have to have a seperate terminal for editing (running locally in the directory mounted via samba) and executing code (running remotely over ssh) on the dev server.

Huzzah.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Sounds like you just reinvented efs [xemacs.org] angie-ftp [emacswiki.org] or tramp. [gnu.org]

    Or you can just go all the way. [sourceforge.net]

    • I've used tramp in the past. It's good, but loading stuff across ssh is just too slow because it sets up a new connection each time (and yes, I've tried fsh...still too slow.) Samba is *way* quicker. FTP suffers from the same problem. I've got a mac, so I can't try linux kernel madness, but I doubt it's fast enough. For crazy lack of speed since the finder can mount an FTP server in the past I've tried to use Filesys::Virtual::SSH [cpan.org] with POE::Component::Server::FTP [cpan.org] to make a FTP/SSH bridge so that I coul
    • I use a thing called cenotaph [sourceforge.net] that Matthias Neearcher wrote, and I ported to perl (it was initially a C++ server and perl client, now both ends in perl).

      You execute the client on the remote machine, with "ceno $filename". It opens the file on the server, your local machine, in your editor. How to open in your local editor is a matter for you to figure out; it's designed out of the box to work with BBEdit (and the command line bbedit(1)). I use ceno all the time.