24 February 2010

Fun with roguelikes on an old Palm


Nothing Unix related this time, however I unearthed a Tungsten T from the depths of my "ancient electronics" cabinet. Due to the device being too limited in terms of free dynamic memory, there was nothing really productive I could do on it; it choked and reset itself on something as harmless as opening a PDF file with PalmPDF. It makes a nice audio and video player however and can cope with a few not too demanding games.


Like Pocket City :-)

However I was even more interested in role playing games and it wasn't long until I discovered Roguelikes for PalmOS. The project hosts ports of Rogue, Larn and Moria.


By default, iRogue looks awful, no colors and such. The porter knew that too and added support for graphical tiles, of which I found none for download. So I created a tileset myself.


Aaah, that looks much better! Unfortunately the project was abandoned six weeks ago and is up for adoption, and nobody reacted to my mail with the tileset attached, so I'm putting the .prc file up for download here.


Wizard mode is too easily accessible in this port. For fun, I went for it and when I died, I decided to respawn undead. Then I created the Amulet of Yendor and left the dungeon.


With a predictable result.

And here comes kMoria.


I found the Moria port more fun and challenging. Getting color support is as easy as installing the included sample kMoriaColorDB.prc file to your palm and enabling color in the game prefs.


On this alpha version of the game, I had problems switching back to the big font, and that's why everything looks a bit tiny here. Furios, I decided to attack the next random person.


Which was no good idea.

On to more gaming.


No, this is not another roguelike, but a port of the C64 emulator Frodo. I really like the onscreen keyboard and that you can add common BASIC commands to the menu.


Smashin' blocks to jiggy three-channel SID music.

Palm OS was never a very open platform, but the usual Open Source suspects are there. What I like about the device is its big screen and the ease of getting software onto it. Give me a modern Linux based tablet that fits in a palm too and has decent connectivity, and I call it an upgrade.



18 January 2010

German license plate - 40 years of Unix

I found a license plate generator online and as you probably guessed, this was the result:



This is actually a valid German license plate (Unna county in Northrhine-Westfalia, just around the corner from here) and it is very likely already taken (two-digit numbers are rare, except for motorcycle plates; this is a full-size car plate however).

I occasionally spot geek license plates; here in Bochum, several BO-FH's are on the road, and some guy from Münster who regularly parks two streets away has a MS-FT plate.

14 January 2010

dritune updated to v0.02


I just updated dritune, a CLI interface for setting DRI driver options, to 0.02. This is a bugfix release with enhanced error handling and there is also a .deb package available now for easy installation. More here.

09 January 2010

YaKuake - Instant terminal for KDE


YaKuake is for you if you ever wished for summoning a customizable terminal with a single keypress. Being in KDE extragear, it is most likely contained in your repositories. To check it out, install the yakuake package and start it from the K Menu.

Once it is started, press F12 to show/hide the Yakuake terminal. Nice and practical, isn't it? What makes this application even better is that it supports splitting the view, as well as detaching of inline shells into separate tabs, which is similar in behavior to the console-based screen, tmux or dvtm window managers.

All functionality is (also) accessible via keyboard shortcuts. To split the view horizontally/vertically, press CTRL-SHIFT-T and CTRL-SHIFT-L, respectively. Create a new tab with CTRL-SHIFT-N. You can close shells using CTRL-SHIFT-R, or by logging out of that shell using CTRL-D or the exit command.

Navigation is straightforward. You can cycle through the shells within a split view using CTRL-SHIFT-Up/Down, and go through tabs with SHIFT-Left/Right. CTRL-SHIFT-Left/Right lets you move a tab to another position.

As with every shell related application, I consider it crucial to customize the settings to my likings and requirements for a streamlined workflow. You might want to increase YaKuake's height to make better use of your screen estate. I also set the application to not stay open when it loses focus, so I can click somewhere and have it out of the way. I also activate the "highlight terminals when they are activated" thing, which is very useful in splitscreen. You can access the settings by clicking the little down arrow on the right of YaKuake's "bottom bar".

28 December 2009

dvtm - a console based tiled window manager


In my last post, I outlined how to do some form of rudimentary multitasking in Bash, but I was still not satisfied. Further research showed that there would be no way around a terminal multiplexer, however screen sucks for me due to its steep and unintuitive learning curve. On K.Mandla's great blog I found the solution: dvtm, a very lightweight tiled window manager for the console. Its beauty lies in that it occupies just around 100k of disk space, does not hog the memory and does not try to accomplish more than it is supposed to.

Becoming familiar with dvtm is a matter of minutes. Install the package from your distribution repositories, go to a console or open an xterm, then input dvtm. You will see Bash within a blue frame. The blue frame indicates that this is the active window. Now press CTRL-G C (press CTRL-G, release the keys, then type a C). A new Bash window pops open next to the existing one and becomes the active window. You can close that window by either logging out of that instance (input exit or press CTRL-D), or by pressing CTRL-G X.

With multiple windows open, you can input CTRL-G <number> to activate window <number> (as designated by its "title bar" text), or CTRL-G J / CTRL-G K to activate the next/previous window. CTRL-G . minimizes or unminimizes the active window. CTRL-G M maximizes the active window. Use CTRL-G SPACE to toggle between grid layouts; this is also the only way to unmaximize a window. CTRL-G ENTER moves the active window in and out of the "master area", which is usually the tile of the biggest size. Finally, dvtm can be left by means of CTRL-G Q, or logging off all hosted shells.

If you need a lightweight multi-window shell environment, dvtm should be surely worth checking out.

20 December 2009

How to work with multiple jobs in Bash


An important feature often overlooked by novice console users is job control. It allows some amount of multitasking on a shell by delegating processes to the background and resuming them at a later point. That way, you don't have to launch a second shell or use additional utilities like screen to manage multiple tasks.

Job control is easy. Let's say you have Midnight Commander running. Hit CTRL+Z and you end up back at the shell prompt. You will notice a line above the prompt stating that mc is suspended. The beginning of the line shows mc's job number in square brackets (1 in this case). Ok, let's use that job number to resurrect mc. Input %1 and voíla, mc is back! Similarly, you can use %1 & to unsuspend mc and continue running it as a background job. Note that background jobs are detached from the terminal and will be suspended as soon as they try to read from or write to it.

When working with multiple jobs, you will find the jobs command very useful, which lists the running jobs with their numbers and status.

A more intuitive way to unsuspend a job is to give part of its command line. %mc will unsuspend Midnight Commander, however if you have multiple instances running it will result in an error. Finally, just inputting % will unsuspend the most recently suspended job.

As you can certainly see, this feature is a real time-saver by allowing you to get running applications out of the way and resume them later.

13 December 2009

How to recover lost data on an ext3/4 partition


I recently had a late-night oopsie with tar, overwriting the file I wanted to package (source code I had worked on for a week). After a few seconds of creepy feelings, I remembered that I use a journaling filesystem and thus, there would be a good chance that there would be several copies of the data still physically lying around on the storage medium.

So, what to do when you lost a file? For your first action, you have two options.

First option: Power off the system without shutting it down, then boot from a live CD. The foolproof option.

Second option: If you can ensure that no new files will be created on the filesystem where the loss occured while you are trying to recover the data, you can work from the running system and avoid further potential data loss from uncleanly powering down the system.

Next, become root and grep the filesystem where the data loss took place.

grep -a -B300 -A300 "searchString" /dev/sdb1 > dumpfile

searchString is a piece of text that preferably only occurs in your lost file. Try to be as specific as possible so you ideally only get results from the file's contents. The -B and -A options specify the number of context lines to output before and after each match. Choose values large enough to include the entire lost file, if possible. Replace /dev/sdb1 with the device node of the filesystem where the lost data is. You can find out the node by just running mount without parameters. dumpfile is the target file containing the found text. Of course the dump file should not be saved on the partition where you lost the data! Save it on another filesystem or a tmpfs if you have one set up. Mounting a USB stick or something for the dump file may be risky because a device node will be created on the root partition, which stinks if your lost data sits exactly there.

After grep is done, examine the dump file with a text editor. If you are certain that it contains your entire lost file in a usable or recoverable state, you can start copying and pasting into empty files, restoring various versions of your file of which a few will probably be current.