There’s an environment variable HISTFILE which determines where ksh saves your command history. By default, if HISTFILE is not set, ksh will save to ~/.sh_history. OpenBSD does not, however, include this default – so your command history is lost at the end of each session. That may be what you want, but if not, you can just add a line like this to ~/.profile:
export HISTFILE=~/.sh_history
Since ksh doesn’t include source you can use . ~/.profile to load your changes.

Advertisements

Adding Eterm backgrounds

January 2, 2009

Random Eterm BackgroundsThis is one of those “I know I’ve bashed my head over this before and Googling doesn’t necessarily get you to the right place but reading the docs or running the right command with –help would fix the problem right away” type posts.

Assuming you want new backgrounds available to all of a systems users, put the images in tile/ and scale/ respectively under /usr/share/Eterm/pix (on Debian and probably most systems). Then run (as root or with sudo) “Etbg_update_list” – and here’s the “i’m such an idiot that I couldn’t figure this out part” – with the full path to pix/ (or run it from within pix/ since it defaults to the current working directory.) Then you can partake of the full hideous beauty which is random Eterm backgrounds.

You probably know this, and if you didn’t you should have read the man page before coming here, but:
kill -USR1 $pid
(with $pid being the pid of a running dd process – which you can get from ps) will cause dd to pause, print out progress statistics, and resume copying. Awesome.
(It outputs in the terminal where dd is running, not where you enter the kill. Just in case you’re looking.)

Over the last month or so, I’ve been doing assorted tasks for the Lehigh Valley’s premier business VoIP provider. One of the more tedious VoIP related tasks is getting out-of-the-box VoIP hardware from its factory default state to fully configured. Nearly all hardware accepts some sort of remote provisioning, but you have to somehow let the phone know the path to the provisioning server (as well as related settings.)

In some cases, you can use DHCP option 66 and specify a TFTP server as you might for other netbooting devices. But in a situation where your providing phones to clients for a Hosted PBX (and in most other situations) TFTP is less than ideal, and relying on control of the DHCP server is unrealistic.

There are (usually) two more ways of providing the configuration information: through the phone’s user interface, and through the web control panel. Just grab your (non-fully-keypadded) mobile and dash off a text message with a link to a Google Maps URI and you’ll get a sense of what the first option is like. The second is only slightly less tedious.

Fortunately it’s not so difficult to tease out the http requests the web interfaces for the various phones need. (Firebug, or at least “View Source,” is a tremendous help in this. Tamper Data, or similar tools, can help in making sure things really work the way you think they do.)

With this information we can build up command line scripts with which we can automate the process of giving phones their initial configuration. prov.rb is a Ruby-based application I’ve been working on which configures phones one phone, IP range, or subnet at a time, logs MAC addresses, and more. (I’ll be committing to GitHub as I get time over the next week. I’d love help working out the kinks, and especially for adding more hardware varieties.

In the course of working on prov.rb, I teased out the POST requests for configuring all of these basic settings on both Aastra and Grandstream phones. In addition to writing a client in Ruby, Python, Perl, or whatever, one can also make these requests quite well with cURL or, my preference, wget. So, in the next two posts I’ll provide sample commands for these two brands of phones:
(I’ll add the links once I write the posts.)

Of general interest is that each company (similar to nearly every other maker of VoIP and networking hardware) use largely identical web panels across their product range. This means the same script will work with basic ATAs as with high end phones and gateways. This is especially true if you are just setting a provisioning path for the phones to get their specific configuration.

The main difference between the Aastra and Grandstream panels is that Grandstream uses cookie based authentication, while Aastra uses basic http authentication. Neither of these would do anything to secure the phones in a hostile network environment, so I won’t even speculate on the reasons for the choice of one over another. The basic authentication is a little simpler to manage than cookies with wget, and you’re not stuck with an extra file to clean up.

If your provisioning lab/supply closet/garage is anything like ours, you probably have quite a few OpenWRT boxes laying around. OpenWRT does include wget as part of Busybox, but this is a crippled minimal version of wget, which is missing options for cookies, authentication, and even manual setting of headers. I believe there is an ipkg available for a full version of wget, which could be useful. I’m still looking forward to installing the Ruby ipkg for use with prov.rb.

(Jump to the fix if you want to skip the introduction.)

Google Sites is the evolution of JotSpot. It allows individuals, teams, or organizations to create simple, revision-tracked web sites. Probably its strongest points are ease of setup and ease of embedding other objects, including Google documents, videos, slideshows, calendars, and any of the “gadgets” available to iGoogle home pages. The most obvious downside is frustratingly limited customizability, as is to be expected from a free hosted solution.

Another problem is that saves can be less than perfect. Configuring and adding gadgets can be particularly frustrating, as you may find yourself starting over several times. Read the rest of this entry »

Matthew Bass has written a nice introduction to the [dead simple] Google Charts API and to gchatrb, a Ruby interface to the API developed by Deepak Jois. (The article links to an older Google code repository. The latest version is at the github link provided here.)

Constructing the URLs for Google Charts is pretty simple, and gchartrb and its Python counterpart are almost as verbose, but it’s obviously easier to integrate the wrappers into a program’s flow.

I like Bass’ idea of using a Capistrano task to update the image, rather than rendering it from Google every time. He is a little harsh, though, on “the medieval monster which is ImageMagick.” I like ImageMagick. I’m awful with anything related to design, images, and the visual arts; but I often find myself lost in the (wrongly placed) ImageMagick docs trying out all sorts of esoteric combinations to do some stupid trick or the other. It may be one of the worst tools to have to get work out of, but in the end it does a pretty nifty (and usually not-quite-what-was-expected) job. If ImageMagick is a medieval monster, it’s Herbert the Timid Dragon:

Herbert the Timid Dragon

French annulment

June 5, 2008

There’s a story which seems to have hopped over from the French blogosphere now making the rounds. Read the rest of this entry »