uHOWTO: Recover stuck modified keys from VMware Player or Workstation

If you use VMware Player or VMware workstation under Linux and you’re an alt-tab fan like me, you might end up with stuck modifier keys, so you can’t use keys like Ctrl, Alt or Shift outside of VMware. Xiao Feng has written a nice script to recover from this annoying condition without having to reboot, and I tought I’d share it with everyone out there:

#!/bin/sh
# Xiao Feng's "Recovering from stuck modifier keys caused by VMware"
# http://bitubique.com/tutorials/recovering-from-stuck-modifier-keys
/usr/bin/xmodmap - << fixme clear shift add shift = Shift_L Shift_R clear lock add lock = Caps_Lock clear control add control = Control_L Control_R clear mod1 add mod1 = Alt_L Alt_R clear mod2 add mod2 = Num_Lock clear mod3 clear mod4 add mod4 = Super_L Super_R clear mod5 add mod5 = Scroll_Lock fixme xset r on xset m 3.5 4 xset b off xset s off

Bourne Shell Server Pages

Easy. Portable. Buzzword-compliant. Ingenuous. Elegant. Right-out wicked cool: Bourne Shell Server Pages. As I write this I’m looking for a excuse to use this revolutionary technology in my next project!
Behold the simplicity of ASP and the power of sh:

<html>
  <body>
    <h1><$ echo "Hello, world!" $></h1>
  </body>
</html>	

Interface21: please take note. I expect a Spring.sh implementation before the year ends. ;-)
[tags]bourneShell, asp, jsp[/tags]

Moving from MyISAM to InnoDB: bulk table conversion

A couple of years ago Ludovico Magnocavallo tackled the issue of bulk conversion of MySQL tables from MyISAM to InnoDB with an elegant bash snippet.

for t in $(mysql --batch --column-names=false -e "show tables" mydbname); do
  mysql -e "alter table $t type=InnoDB" mydbname;
done

The original post also suggests using grep to limit the scope of the conversion to just a few tables.
(It seems that now Google *does* yield practical answers to this question ;-)
[tags]bash,mysql,innodb[/tags]

Get stock quotes into a spreadsheet

This code stnippet grabs a .CSV file from Yahoo! Finance with selected quotes. This is very useful to keep an eye in your portfolio from within OpenOffice.org Calc, Gnumeric, Kspread,Microsoft Excel or similar program using your very own models.
To use it edit the paths and the symbols in the script, run it periodically from cron(8) to get $DEST/quotes.csv, import the file once and reference it from your own spreadsheet.

#!/bin/sh
TMP=/home/user/tmp
DEST=/home/user/prj/mba/dinero/portafolio
wget -q -O $TMP/quotes.csv 'http://finance.yahoo.com/d/quotes.csv?s=^MXX+^DJI+^IXIC+MXN=X+AMXL.MX+ARA.MX+BIMBOA.MX+CIEB.MX+FEMSAUBD.MX+GFBBB.MX+GMODELOC.MX+TELMEXL.MX+TLEVISACPO.M+WALMEXV.MX&f=sl1d1t1c1ohgv&e=.csv'
echo '"SYMBOL","VALUE","A","B","C","D","E","F","G","H"' > $DEST/quotes.csv
cat $TMP/quotes.csv >> $DEST/quotes.csv