Kernel word recovery crack, Mobile themes website for samsung wave 525, Dekha ek khwab sony tv title song, Song zombies on your lawn, Bloody mary nerve endings mp3, Digittrade tv jukebox, Padosan songs mp3, Gold cup series 70 manual, Nieuwste versie van mozilla firefox en, Cant install spotify on mac, Web brute force password cracker, Belkin g peek driver windows 7

Archive for the ‘Linux’ category

Tool to encode, tag and rename audio files

March 16th, 2011

Wanting to put some order in my collections of band rehearsals, I dug up an old tool I once wrote to automatically tag mp3 files, and extended it to also automatically convert and rename them.

It runs under Linux, and needs a few perl modules and external programs depending on what you want it to do. (MP3::Tag, vorbiscomment, oggenc, lame, mplayer, String::Approx). Modules are loaded dynamically, so you need all of them.

Because some examples say more than…

# Tag and rename all files in current directory using fuzzy match
# against info.txt
# Tag all mp3 files using info.txt, assuming the filename starts 
# with the track number and -
$mytagtool --match "%n - " *.mp3
# Encode all wav files to ogg, and tag using files.txt
$mytagtool -o ogg --info-file files.txt *.wav
# Recode all ogg files as mp3, and rename them using a pattern.
$mytagtool -o mp3 --force -n "%track:02d%. %album% (%year%) - %title%" *.ogg

An info file would look like this:

artist: Urban Caravan
album: Répèt du 8 mars
year: 2011
1. Smoke & Whiskey
2. A'Prova
3. Urban Caravan

Voilà. This script is pretty much untested, so if you want to try it, I would advise you to use the –simulate and –verbose options to see what happens.

Use the perldoc for much more information.

Attached Files:

Prochain passage de bus CTS à Strasbourg

February 28th, 2011

Un petit script en Perl qui affiche les prochains passages des bus et des trams dans la CUS Les codes sont affichés aux arrêts, ou peuvent être trouvés sur [cette page][code_arret].

Ce script est prévu pour fonctionner sous Linux et nécessite l’installation du module [HTML::TreeBuilder::Xpath][treebuilder_xpath]. Renommez le fichier joint en *prochainbus*, copiez le dans un répertoire d’exécutables comme */usr/local/bin*, et rendez le exécutable.

Spécifiez le code arrêt sur la ligne de commande, ou créez dans votre répertoire personnel un fichier appelé *.prochainbus* contenant le code d’arrêt.

$ prochainbus -v 272
Arrêt: Hôpital Civil (272)
15h50: 15 Lingolsheim Alouettes
16h05: 15 Lingolsheim Alouettes
15h51: 15 Robertsau Boecklin
16h05: 15 Robertsau Boecklin
$prochainbus 91320
Erreur renvoyée par le site:  Votre saisie comporte les anomalies 
suivantes :Le code arrêt saisie n'existe pas 

Attention, je ne saurais être tenu pour responsable si les informations ne correspondent pas, et que par ce fait vous arriveriez en retard !

*[CUS]: Communauté Urbaine de Strasbourg


Attached Files:

Linux tool to list open files

February 23rd, 2011

There is a tool named lsof that can display which file descriptors are opened by a process. Although it’s very useful, it can be a bit difficult to use, and doesn’t always output the information I need, thus urging me to write a new tool. It is called _of_, it is written in perl and uses the /proc filesystem to get its information. It requires a Linux system with a kernel 2.6.22 or more recent.

### Examples

Some examples to show what it does follow.

List the pid, process name and filename of the files opened by processes that match the name vim:

$of vim
10059 vim.gnome /home/stilgar/bin/.of.swp

List files opened by evolution and only display their filename:

$of --fields f evolution | grep "\.db$" | sort | uniq

List all the pipes that are opened by ogmrip and its children (in this case mencoder). This allows us to see what information ogmrip exchanges with mencoder, and in this case retrieve information about mencoder’s progress:

$of --type p --children --show-fd ogmrip
2054 ogmrip 19 pipe:[15582]
2054 ogmrip 20 pipe:[15582]
2054 ogmrip 23 pipe:[912459]
2054 ogmrip 25 pipe:[912460]
16132 mencoder 1 pipe:[912459]
16132 mencoder 2 pipe:[912460]
$cat /proc/2054/23
 Pos: 216.6s   5415f (45%) 31.04fps Trem:   3min  45mb  A-V:0.000 [803:0]

Use an environment variable to set a default output format:

$export OF_RC=$'--fields pndlhsf --format "%5d %-15.15s %3d [%-3s] %-7s %-7s %s\n" --unit h'
$of gnome-session -c
1670 gnome-panel       2 [RW+] 2.0K    2.0K    /home/stilgar/.xsession-errors
1678 nautilus          1 [RW+] 2.0K    2.0K    /home/stilgar/.xsession-errors
1678 nautilus          2 [RW+] 2.0K    2.0K    /home/stilgar/.xsession-errors

Which devices does the totem media player open ?

$of totem -c -t v
20360 totem /dev/null
20360 totem /dev/snd/timer
20360 totem /dev/snd/pcmC0D0p

» Read more: Linux tool to list open files

Attached Files:

  • txt of

    List open files

Dual monitor with xorg on a radeon 9200SE

August 15th, 2009

*yawn* Such a boring topic… It took me a lot of searches to find out how to configure my X server to handle two monitors on one RV280 graphics card. (Well, clone mode was easy…)

So this is my xorg.conf:

Section "Device"
        Identifier      "radeon"
        Driver          "radeon"
        Option          "Monitor-DVI-0" "Monitor 1"
        Option          "Monitor-VGA-0" "Monitor 2"

Section "Monitor"
        Identifier      "Monitor 1"
        Option          "LeftOf" "Monitor 2"
        Option          "PreferredMode" "1280x1024"

Section "Monitor"
        Identifier      "Monitor 2"
        Option          "PreferredMode" "1024x768"

Section "Screen"
        Identifier      "Default Screen"
        Device          "radeon"
        SubSection "Display"
            Viewport    0 0
            Depth       24
            Virtual     2304 2048

Not everything works perfectly. KDE 4.3’s kdm and kwin are sometimes confused and don’t display things on the “wrong” window. Flash is broken in fullscreen mode: I get a small video surface with black borders on the left and the right, and white borders above and below. It’s still useful for debugging and xrandr --output VGA-0 off turns the second monitor off.

Generate PHP accessors

July 29th, 2009

I’m working on a PHP project right now, and finally got tired of writing the same code over and over again (and a bit nostalgic of Perl, my first love), so here is gen_php_accessors.

# Martijn van der Kwast 2009
# Use and distribute freely
use Getopt::Std;
$indent = '    ';
$indent2 = $indent x 2;
if ( ! getopts('csGatrh') || $opt_h ) {
	print STDERR <<HELP;
gen_php_accessors [-c] [-s] [-G] [-a] [-t] [-h] < variable_declarations.php
Generate PHP accessors from member variables.
 -c Also generate constructor
 -s Also generate setters
 -G Don't generate getters
 -a Generate getters, setters, static getters and constructor
 -t Generate static getters
 -r Generate static setters
 -h Display this help
	exit -1;
$opt_s = 1 if $opt_a;
$opt_c = 1 if $opt_a;
$opt_t = 1 if $opt_a;
$visibility = '(?:(?:var|public|private|protected)\s+)';
$identifier = '[a-z_]\w*';
while(<>) {
	if ( /^\s*(?:static\s+)${visibility}?\$($identifier)\s*[;=]/i ||
	     /^\s*${visibility}?(?:static\s+)\$($identifier)\s*[;=]/i )
		push @static, $1
	elsif ( /^\s*${visibility}?\$($identifier)\s*[;=]/i ) {
		push @fields, $1 
if ( $opt_c ) {
	print "\n";
	if ( @fields ) {
		$args = join(', ', map { "\$$_" } @fields );
		print "${indent}public function __construct( $args ) {\n";
		print "${indent2}\$this->$_ = \$$_;\n"
			for @fields;
		print "${indent}}\n";
	else {
		print "${indent}public __construct() {  }\n";
if ( @fields ) {
	if ( ! $opt_G ) {
		print "\n";
		print "${indent}public function $_() { return \$this->$_; }\n"
			for @fields;
	if ( $opt_s ) {
		print "\n";
		print "${indent}public function set_$_( \$$_ ) { \$this->$_ = \$$_; }\n"
			for @fields;
if ( @static && $opt_t ) {
	if ( $opt_t ) {
		print "\n";
		print "${indent}public static function $_() { return self::\$$_; }\n"
			for @static;
	if ( $opt_r ) {
		print "\n";
		print "${indent}public static function set_$_( $_ ) { self::\$$_ = $_; }\n"
			for @static;

Put it in a directory in $PATH, chmod +x it, and use it as a filter on the member variables you just selected. (vim: '<,'>!gen_php_accessors -a ).

You may want to adapt a little to match your PHP coding style (indentation, function names).

(modified to include constructors and static members)

Script idea

October 17th, 2008

I noticed I often tend to type the same sequences of commands when I look for files in a directory. For instance: “ls *mp3”, followed by “ls *ogg” if there aren’t any mp3s. Repeating such commands makes me feel like a cymbal-banging monkey, so what I need here is a script that does the boring stuff for me (and guesses my mind. and makes coffee. Damn, I’m hungry now.)

This is a (late night) attempt:

use strict;
use warnings;
use File::Glob qw(:globally :nocase);
my %types = (
    audio => [ qw/mp3 ogg wmv wav voc flac/ ],
    video => [ qw/divx avi wmv ogm flv mpg mpeg/ ],
    pictures => [ qw/jpg jpeg tiff tif pcx bmp png svg/ ],
    archives => [ qw/rpm deb tgz tar.gz zip rar iso/ ],
    docs => [ qw/txt nfo doc pdf/ ],
    web => [ qw/htm html css/ ],
    scripts => [ qw/pl py sh lua/ ],
    code => [ qw/c cpp h hpp/ ],
sub abort_with_help {
    print "Syntax: list <type>\nWhere type in:\n";
    print "* $_: " . join(', ', sort @{$types{$_}}) . "\n" for keys %types;
    exit -1;
abort_with_help unless my $type = shift;
unless (exists $types{$type}) {
    print "No such type.\n";
my $glob = '*.{' . join(',', @{$types{$type}}) . '}';
if (my @files = glob($glob)) {
    print "$_\n" for (@files);
} else {
    print "No $type files found in the current directory.\n";

Compaq presario error 280 at boot

October 12th, 2008

I’ve been playing with a Compaq Presario 1245. As soon as I got it I repartitionned the hard-drive and installed linux, which was fun, but also a bad idea. Apparently the BIOS needs a hibernation partition, and if it doesn’t find it, it just overwrites existing partitions at random.

The official solution is to run PHDISK.exe if you can find it on your old Compaq installation disks. That didn’t work for me since I never had any.

The working solution is to run lphdisk for linux instead. This will repartition your hard drive, so be sure to make a backup first. If you can’t compile lphdisk on the computer you need to fix (because, for instance you’re using puppylinux or systemrescuecd to boot it), compile a static version on another linux computer (Alter Makefile to Include -static in the CFLAGS), and run it from floppy disk (haha! you still have one of those, don’t you?) or USB key.

Yeay, an old laptop !

October 2nd, 2008

My brother found me an old Compaq Presario 1245 at his association (is it still called Déclicks ?). It contains a K6-2 333MHz processor, a single USB port, and an amazing 32MB of RAM, more than enough to read text documents in the bus.

I burnt a Puppy Linux 4.1 CD (after some swearing, because my Ubuntu Hardy only recognizes my CD burner one time in 10) and attempted to run it. This failed, 32MB is not enough, and the boot stops at the message “Loading kernel modules”. I restarted it with the boot parameters “pfix=rdsh”, and created a swap partition and activated it. This did it, and the puppy was alive, booting me into a graphical user interface. After playing a little with the live CD, I decided to install it on the hard drive, which sped up matters a lot. Puppy linux is downright snappy on this configuration, and includes enough tools to make me feel right at home (in the command-line mostly). Installing the vim package makes it even better.

I installed mplayer, but that was a waste of time. It’s way too slow to play movies. Playing MP3 uses about 20% of the processor time. 32MB of RAM isn’t enough to run any gecko based browser. They will start, but they will take minutes to switch between windows. The links browser is a better option, it can even render pages in graphics mode using “-g” on the command line, and it’s faster than, uh, something that’s really fast at rendering web pages, but it may horrify CSS purists and other designers.

Retro is fun.

Debian packages, auto{make,conf}

July 19th, 2008

I’ve been playing a little with automake and autoconf again. Nothing new, I still hate them, maybe more, even if I understand the vital role they play in the open source community.

I was about to write a rant-like post about the difficulties I encountered, but instead I’ll just post what I learnt.

» Read more: Debian packages, auto{make,conf}

Delete old configuration files in Ubuntu

July 17th, 2008

I usually forget to use the --purge option when I apt-get remove packages, so heaps of unused configuration files accumulated on my system.

Deborphan is the solution.

sudo dpkg –purge `deborphan –find-config`

It can also automatically remove orphaned debian packages, but I haven’t trusted it to autoremove mine, as the list is quite long and I haven’t taken the time to review it.