LogoPhly, boy, phly
the weblog and site of Matthew Weier O'Phinney

Sunday, January 25. 2004

Ctrl-S and Ctrl-Q in *nix systems

I just ran into this not long ago, and wish I'd discovered it years ago. Basically, Ctrl-S suspends a process, while Ctrl-Q resumes it. This is useful when in g/vim or screen and you manage to lock up your application because you accidently hit Ctrl-S when reaching for another key combo.

Posted by Matthew Weier O'Phinney in Linux, Personal at 14:08 | Comments (0) | Trackbacks (0)

Friday, January 23. 2004

More SSH tips: Tunnelling

I wrote up a short tutorial today on the IT wiki about SSH tunneling. What I didn't know is that you can start a tunnel after you've already ssh'd to another machine. Basically, you:

  • Press Enter
  • Type ~C

and you're at an ssh> prompt. From there, you can issue the tunnel command of your choice: -R7111:localhost:22, for instance.

Posted by Matthew Weier O'Phinney in Linux, Personal at 17:19 | Comments (0) | Trackbacks (0)

IT hiring principles

I was just reading an article about the Dean campaign's IT infrastructure, and there's an interesting quote from their IT manager, Harish Rao:

"I believe in three principles", he said. "First I always make sure I hire people I can trust 100%. Second, I always try to hire people who are smarter than I am. Third, I give them the independence to do as they see fit as long as they communicate about it to their other team members. We've had a lot of growing pains, a lot of issues; but we've been able to deal with them because we have a high level of trust, skill and communication."

I know for myself that when I (1) don't feel trusted, and/or (2) am not given independence to do what I see as necessary to do my job, I don't communicate with my superiors about my actions, and I also get lazy about my job because I don't feel my work is valued.

Fortunately, I feel that in my current work situation, my employers followed the same principles as Rao, and I've felt more productive and appreciated than I've felt in any previous job.

Posted by Matthew Weier O'Phinney in Linux, Personal, PHP at 08:52 | Comments (0) | Trackbacks (0)

Wednesday, January 21. 2004

Making RCS a little easier...

One thing I noticed today when using RCS is that it isn't terribly user friendly -- you need to checkout a file to make edits. Often, I make edits, and then want to commit my changes.

So I wrote a wrapper script called revise. It makes a temporary copy of the file you've been editing, checks it out of RCS with locking, makes it writeable, moves the temporary copy to the permanent name, checks it in and unlocks it (which prompts for a log message), and then makes the file writeable for the user and group again. The script is outlined here:

    #!/bin/bash
    FILE=$1
    cp $FILE $FILE.new
    co -l $FILE
    chmod u+w $FILE
    mv $FILE.new $FILE
    ci -u $FILE
    chmod ug+w $FILE

Being the ROX-Filer centric person I am, I also wrote a quick perl script called rox-revise that I can then put in my SendTo menu. It parses the file's path, changes to that directory, and then calls the revise script on the filename, from within a terminal. This script follows:

    #!/usr/bin/perl -w
    use strict;

    use vars qw/$path $file $TERMCMD $REVISE $ZENITY/;

    # Configurable variables
    $TERMCMD = "myTerm";    # What terminal command to use; must be xterm compliant
    $REVISE  = "revise";    # What command to use to revise (i.e. rcs ci) the file
    $ZENITY  = "zenity";    # The zenity or dialog or xdialog command to use

    # Grab the filename from the command line
    $path = shift;
    $file = $path;

    # If no file given, raise a dialog and quit
    if (!$path || ($path eq '')) {
        system(
            $ZENITY, 
            '--title=Error', 
            '--warning', 
            "--text=No path given to $0; rox-revise quit!"
        );
        exit 0;
    }

    # Get the path to the file and switch to that directory
    if ($path =~ m#/#) {
        $path =~ s#^(.*)/.*?$#$1#;
        if ($path !~ m#^/#) { $path = "./$path"; }
        chdir $path or die "$path not found!n";
    } else {
    # Or else assume we're in the current directory
        $path = './';
    }

    # Get the filename
    $file =~ s#^.*/(.*?)$#$1#;

    # Execute the revise statement
    my $failure = system($TERMCMD, '-e', $REVISE, $file);
    if ($failure) {
        # on failure, raise a dialog
        system(
            $ZENITY, 
            '--title=Error', 
            '--warning', 
            "--text=Unable to revise $file"
        );
    }

    1;

Now I just need to check out Subversion, and I can have some robust versioning!

Posted by Matthew Weier O'Phinney in Linux, Personal at 22:20 | Comments (0) | Trackbacks (0)
(Page 1 of 1, totaling 4 entries)
  • Home
  • Resume
  • Blog
  • Phly PEAR Channel
  • Contact Me
  • About this site

ZCE

Zend Education Advisory Board Member

Add to Technorati Favorites

Calendar

January '04 Forward
Mon Tue Wed Thu Fri Sat Sun
      1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31  

Quicksearch

Links

  • PHLY - PHp LibrarY
  • Paul M. Jones
  • Mike Naberezny
  • Shahar Evron
  • Planet PHP
  • Zend Where I now work
  • Garden.org Where I once worked

Archives

October 2008
September 2008
August 2008
Recent...
Older...

Categories

XML Linux
XML Personal
XML Aikido
XML Family
XML Programming
XML Dojo
XML Perl
XML PHP

All categories

Syndicate This Blog

XML RSS 0.91 feed
XML RSS 1.0 feed
XML RSS 2.0 feed
ATOM/XML ATOM 0.3 feed
ATOM/XML ATOM 1.0 feed
XML RSS 2.0 Comments

Show tagged entries

xml best practices
xml books
xml conferences
xml dojo
xml dpc08
xml file_fortune
xml linux
xml mvc
xml oop
xml pear
xml personal
xml php
xml phpworks08
xml programming
xml ubuntu
xml webinar
xml zendcon
xml zendcon08
xml zend framework
© 2004 - present, Matthew Weier O'Phinney
matthew-web <at> weierophinney.net