I have been complaining for the last few days about my the font that I have been using in my terminal, so I decided to actually do something about it.
What I didn’t know, was how to go about installing some nicer fonts. While talking to James about this, he suggested that I can just create a ~/.fonts directory, and place the fonts in there. A great little piece of information, that I had no idea about.
Category: Linux
Adding fonts to linux
Handy bash one liner for getting the ip address of a host
Something I find that I have to do in bash scripts occasionally is to grab the ip address of a specific computer. This requires a little parsing in most cases (due to cnames and multiple ipv4 addresses for a host).
The following one liner should handle all of this correctly:
host ServerName | sed -rne 's/.*has address ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/\1/p' | head -n 1
Note: Syntax error was picked up by freespace
Multiplayer Snake
Well, here we have yet another challenge… Though this one does not involve any prizes, as I want my students at the NCSS camp to actually do their projects and not spend all their time on my competition.
So, what is has to be done here? Well it is quite simple really… Design a bot to play snake for you. I am forcing people who submit to write their solution in python (though there is no real need, other than I am teaching python at the moment). The input/output of the program is quite simple… The output consists of one of the following four letters: ‘U’, ‘D’, ‘L’, ‘R’ (corresponding to Up, Down, Left and Right).
The input consists of the following:
width height snake_id
board layout
An example is:
7 7 A
..*....
..A....
..a....
..a....
.......
.......
..Bbbb.
Where * is an apple, . is an empty cell, the uppercase letters are the head’s of the snakes, with the lowercase being the body.
Code for the engine is located in my repository under the snake project. Submissions should be made to my email address, or in person.
The initial competition will have bots go up against each other, with no time limit given per move. The later rounds will ensure that all bots get equal cpu time (by running the faster bots more often).
Not so smooth transition to xubuntu-intrepid
So James and I decided to take the plunge and install the intrepid update on a newly installed machine we had here (it had had xubuntu-hardy installed only a week earlier).
This machine was using the nvidia binary package, but other than that did not have anything that was from a restricted repo.
Upon the upgrade we found that the nvidia package no longer works. In fact, it no longer compiles the kernel module (even though it claims that the package is installed correctly). This left us without an X11 server. Even when trying to use the nv driver we could not get it to work.
On a side note: We found that the nv driver is now no-longer installed by default.
After about an hour of trying to get things to work, we decided that we will just have to live with the vesa driver. Although this makes the system slow, at least we can use X11.
Another thing I noticed, is that it now spams me with an annoying motd, I mean sure system stats on login is may be nice for some people, but I already have most of that coded in my scripts. The easiest way to get rid of this is to remove the package landscape-client with the following command:
sudo aptitude purge landscape-client