Archive

Archive for October, 2008

Finding Out Your External IP Address from the Shell

October 11th, 2008 admin No comments

I’m writing a script that needs to know the external IP address of the current machine (ifconfig only gives the local network address)

wget -q -O - http://checkip.dyndns.org | html2text \
| sed s/Current\ IP\ Address\:\ //

What this does is:

  1. hit http://checkip.dyndns.org, silencing wget’s output and redirecting the downloaded file to stdout
  2. parse the html page as text
  3. get rid of the cruft (I was thinking about using a complex regex here, but the IP address prefix seems less of a dependency concern than the actual dyndns service)
Categories: System Admin Tags:

Why does my keypad reset my X server?

October 6th, 2008 admin No comments

For a while I’ve had this weird bug on my Ubuntu laptop where, while using an external keyboard, if I hit any key on the numeric keypad the current X server would reset. Incredibly annoying. What’s worse, is that I never really got around to “fixing” the problem, I just trained my right hand to not stray too far to the right. But of course, accidents happen, and this last time of losing work was the final “home loan that brought down the US economy”.

The problem originates somewhere between XGL and using your numeric keypad to control the pointer (known as Mouse Keys).

If you’re sure you don’t need XGL (check your xorg.conf first!), then simply remove it:

sudo apt-get remove xserver-xgl

And disable your Mouse Keys:

  1. System -> Preferences -> Keyboard
  2. Mouse Keys (tab)
  3. Uncheck “Allow to control the pointer using the keyboard”

Now restart your machine, and VoilĂ 

Categories: Ubuntu, Uncategorized Tags: