Archive for January, 2009

Linux, from server to desktop

Monday, January 5th, 2009

I remember roughly ten years ago, when a friend came by and upon attaching his hdd to my machine a nice Afterstep desktop booted up. It was in the Windows 95-98 era, where one couldn’t boot a Windows OS with a different motherboard (actually XP still sucks with this), so I really thought it was astonishing. Things “worked” – for some reason Linux was “stability”. Linux: as a server and, to be honest, as a very weak desktop – but even with the guy doing nearly everything on the command line, the lack of blue screens struck me.

Nowdays all I hear is that the desktop Linux is here (X is the year of the Linux desktop, where X is the current year) – and actually I just don’t think so. By forcing this very strong server system to behave like a desktop, it’s just loosing quality. Hard lockups, bad drivers, the stupid rants and quarrels about the binary blobs and all the brokan applications – it’s not what I saw a decade ago.

Just for fun, search for the word “segfault” on some of the Linux distributions I used and liked (number of results): Arch ~322, Ubuntu 250, Gentoo 183.

Debian community is so terrible, there’s not much point in using their forums in my opinion – what’s important is not these numbers, but the fact that others are experiencing these issues as well. I don’t care if it is an nvidia driver, a udev issue, a broken browser or whatnot, segfaults, lockups and the Magic SysRequest Bicycle Repairmen are all here to stay.

Convert m4a to wav or flac with script

Thursday, January 1st, 2009

For some reason Winamp couldn’t play the Apple Itunes m4a files for me, so I wanted to have a quick solution to convert m4a files to lossless flacs. VLC can write into files as an output, but with that the dumping speed is 1:1, which is not very fast. Basically the solution is just a couple of shell commands, so if you know mplayer, feel free to check the code bellow.

Okay, this is going to be pretty rough: this is a php shell script, I run on Windows, because:

  • I don’t like Cygwin and I totally hate cmd.exe batch scripting (in this case FOR /R and backslashes).
  • I know about the ecmascript and vbscript interpreters and yes, I totally hate those, because they suck compared to plain old Bash and friends.
  • This is a command line php script; I’m on Windows, I registered the .cphp file extension to be handled by php cli, so I just press enter on such file. Believe me, this saved me hours of work, especially at my workplace, where I am using XP and cygwin is broken like hell (I don’t know the admin password to remove it). I know Python is all the hype, but I couldn’t care less.
<?php
$files = explode("\n", `dir /b /o:n *.m4a`);
$mplayer = 'Q:/bin/mplayer/mplayer';
$flac = 'C:/Progra~1/FLAC/flac';
foreach ($files as $file) {
$file = trim($file);
if (!empty($file)) {
echo "Converting $file\n";
shell_exec("$mplayer -vc null -vo null -af volnorm -ao pcm:fast:waveheader:file=\"$file.wav\" \"$file\"");
shell_exec($flac . ' -8 "' . $file . '.wav" ' . str_replace('.m4a.wav', '.flac', $file));
}
}