Monday, May 24, 2010

Strange Linux error message on static and DHCP

I was modifying a /etc/networking/interfaces file to alias one NIC to have both a static and a DHCP address. I received a strange message:
SIOCSIFFLAGS: Cannot assign requested address
Surfing didn't find the exact answer, but lead to finding it. One must always have the DHCP address first and attached to the non-aliased interface. Ergo, this works:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth0:0
iface eth0:0 inet static
and this does not:
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static

auto eth0:0
iface eth0:0 inet dhcp 
And because I didn't want the DHCP interface to the the default, I added the following to that interface:
up route del -net 0.0.0.0 dev eth0

Sunday, April 25, 2010

Character at a time in bash

I was goofing around with fixing html generate from W4W. I could have use perl or a hundred other things, but I wanted see if I could do in bash, for no particular reason. Here it is.
#! /bin/bash

# this script converts an html file so that all markup ('<'...'>')
# occurs on a line by itself with no embedded newlines.  all other
# characters are simply echoed.  all this requires forcing bash
# to read one character at a time.

in=false
IFS=

while true
do
    if read -n 1 c
    then
        # if newline, and we're inside of '<'...'>', just
        # echo a space.  otherwise echo a newline
        if [[ $c == '' ]]       
        then
            if $in
            then
                # if we're in '<...>', echo just a space
                echo -n ' '     
            else
                echo
            fi
        else
            # if '<', note it, echo a newline and '<'
            # else if '>', make it, and echo '>'
            # else echo character
            if [[ $c == '<' ]]
            then
                in=true
                echo
                echo -n "$c"
            elif [[ $c == '>' ]]
            then
                in=false
                echo "$c"
            else
                echo -n "$c"
            fi
        fi
    else
        break
    fi
done

Wednesday, February 10, 2010

Ubuntu raw lp printing

For some reason, it appears the default font size for a simple lp command is ~5 CPI and LPI. In order to make it reasonable (80x66), I had to set the CPI to 16.5 and the LPI to 6.5:

Friday, January 8, 2010

Removing previous ubuntu kernels

dpkg --list | grep '^ii.*linux-image'
sudo dpkg --remove linux-image-2.6.31-15-generic

Monday, December 28, 2009

Paste Special... Unformatted in Office Mac 2008 PowerPoint

Geez. Too much time looking into such a simple thing. I'm a big fan of using the keyboard instead of the mouse -- much faster for me. No one seems to have a good answer for a keyboard mapping of pasting into PowerPoint 2008 for the Mac. Word, people seem to have. As close as I could easily get is using System Preferences -> Keyboard, Keyboard Shortcuts, Application Shortcuts. And none of the Microsoft Applications even show up so one has to use "All Applications". Lame. Here's a screen shot.

Wednesday, December 23, 2009

Ripping ISOs under OSX

sudo umount /dev/disk1s0
sudo dd bs=1m if=/dev/disk1 of=NameOfIso.iso
and, perhaps most importantly:
drutil burn NameOfIso.iso
This last one helps a lot -- mounting via Disk Utility seems to corrupt certain ISOs...

Thursday, December 17, 2009

Small Linuxes (Linuxi?)

For no good reason, other than curiosity, I wanted to install Linux on an ancient IBM thinkpad 240 maxed out with 192M (!) of dram and a 10G hard drive. I was able to install Ubuntu 9.04 on it, but with some work. The laptop will not boot from its USB (1.0!) port automatically. I had in the past taken the drive out, put it in a desktop, and use that configuration to load OSes. This time, I was able to modify the autoexec.bat file on a wakepup floppy to point to the correct vmlinuz and image files on the USB attached CD (the floppy for Ubuntu didn't recognize it, and neither did smart boot manager) That worked well enough, and 9.04 run okay, if slowly. I then upgraded the machine to 9.10. It did nothing but swap, totally thrashing, just running the OS with no applications. No happiness there. I then tried Damn Small Linux, but it wouldn't recognize the video modes and I couldn't find a workable VGA cheat code. Knoppix was up next, with similar results. Puppy Linux installed without a hitch and that's what the machine is running now...

Overall, too much time spent for too little gain. Should have surplussed the machine and bought a $200 slightly more capable used machine. FWIW.