Dec 31, 2011

I was looking to customize my Konsole'stitle. I wasn't entirely happy with the default. I wanted `~' to be displayed when I was in my home directory and I didn't want to display my fully qualified host name.

What I wanted was the following when in my Home directory on my machine named `zoom': pablo@zoom:~

A few months ago I had the need to mimic an interactive at.Basically, I needed a sleep until a certain time. I rummaged around the Web and found the solution. This script implements the solution with a wee bit of error handling.

Certain processes are not multi-threaded. For example, bzip2. If we have a set of files which needs to be compressed, bzip2 can be handed the list of files and it'll compress the files one after another. On a single processor machine, this works well. On a multi-processor machine though, all but one processor are idle.

What's required is for the files to be placed in a queue and each bzip2 process is handed one file to compress. When it's finished, the next file in the work queue is processed until all the files are processed.

The thread_task shell script is a generic work queue script. It will run any command against a set of files. By default, it will determine how many processors are on your machine and run at most that many simultaneous processes. The script has a nice switch as well.

Todo

Enable the list of files to come from stdin so we can pipe the output of, say, find.

If you'd like to convert many files to Apple TV 2 format via the command line, the script will do it for you. It's simply a wrapper around HandBrakeCLI. I've tested .mkv (what started the script) and .avi. .ISO's should also work. It's whatever HandBrakeCLI supports.

Updates:

Added -d target_dir option

Error handling on arguments - if not a file, skip it.

Handbrake insists on the input file residing in the current working directory. The shell script makes it so.