Wednesday, April 23, 2014

Paging/Scrolling in GNU screen

I'm having some intermittent network problems at home today, so to get some work done I'm running all my terminal sessions to work servers in GNU screen.  I rely on the terminal scrollback a lot.  To look at that in screen, ctrl-a [ puts you in copy mode where arrows, page up and page down, and all vi movement commands work.  Esc exits this mode.

Wednesday, October 12, 2011

Preserving a leading zero on a number in a text field in Excel

At work we're writing UPC codes to a TSV file. Often a UPC has a leading zero, which is automatically whacked when the file is opened in Excel. The trick is to write the UPC cell to the TSV file as

="027297909021"

This preserves the zero.


Friday, August 19, 2011

OMG, command line editing in mysql client

This is freaking awesome. To enable command line editing and searching in the mysql client, create ~/.inputrc and add the following lines...

set keymap vi
set editing-mode vi

Bam, vi commands in the shell. This is literally shaving hours off my work time.

Friday, March 25, 2011

Perl Module Tricks

To check the existence of a module, if the following completes with no errors, it's installed...

perl -MXML::Simple -e 1

To get the version of a module...

perl -MXML::Simple -e 'print "$XML::Simple::VERSION\n"'

Removing a CVS sticky tag

Yes, I'm sorry to say, I still have to use CVS for some tasks. We've talked about upgrading to SVN, at least, but I doubt it will happen soon. To remove a sticky tag and update a file to the latest revision (HEAD), use the following...

cvs update -A filename

Thursday, November 18, 2010

'clear' command in Cygwin/Terminator

I'm stuck on a Vista box for a desktop gateway to development servers. One of this things I miss is the clear screen command ('clear"). Other users have reported with Cygwin in a cmd window, a ctrl-L clears the screen, but this doesn't work for my environment.

I just installed the ncurses package in Cygwin and now have a working 'clear' command in Cygwin under Terminator.

Tuesday, November 10, 2009

Using mysql cli client in MAMP

I'm on a new contract and we're using OS X for development. Instead of getting the full LAMP stack for OS X, they use the MAMP (Mac, Apache, MySQL, PHP) collection for a one-click solution. http://www.mamp.info

MAMP includes the MySQL GUI tools, but I was wanting to use the command line version of the mysql client. Here's how...
/Applications/MAMP/Library/bin/mysql -uroot -p