Thursday, November 8, 2007

A CMD.exe tidbit worth indexing

If you've done SETLOCAL ENABLEDELAYEDEXPANSION in your batchfile
then subsequent ECHOes of exclamation marks!!!! and even parts of
environment variables that contain exclamation marks
(including FOR loop vars) will fail to be emitted, '!' is used as a
runtime-delimiter (instead of evaluation-time's %) for environment
variables when DelayedExpansion is turned ON.

Sunday, March 4, 2007

Home again, home again, jiggity-jig

The weather was clear and above freezing up to the turnoff for the bridge; thereafter it got cloudy and eventually snowy and the temp fell below zero. Around the turnoff I found myself in the midst of a DND convoy, after passing a couple of trucks I backed-off to ~90 km/h and trundled across the bridge. Passed the _fateful_ spot where we crashed last month and stopped at the Noodle House for a soup after leaving a message on Kele's cell. Dropped by her house, got the keys, unloaded, gassed-up, dropped off the truck/van and slid (it was icy underfoot now) over to the bank - I'm taking the bus tomorrow! Got home to find Muff w/big saucer eyes (maybe she didn't recognize my hairdo, or she'd had too many strange visitors?) but she calmed down pretty quick and was soon fighting the mouse for attention from my right hand, I'm not sure she's stopped purring even yet (~1 hr). Me? I'm catching up on the Simpsons while I blog and read during the dumb commercials...awaiting your call.

Wednesday, January 17, 2007

su with ruby

# Ruby snippet demonstrating use of prompt with su

require 'net/telnet'

def loginViaTelnet server
telnet = Net::Telnet.new({'Host' => server, 'Prompt' => /[$%#>]|Password[: ]*\z/}) { |str| print str }
telnet.login("userid1", "password1") { |str| print str }
return telnet
end

def suToOtherUser telnet
telnet.cmd('su - otherUser') #{ |str| print str }
telnet.cmd('otheruserPassword') { |str| print str }
end