Dienstag, 7. Mai 2013

Quadratmeterpreise für wg-gesucht.de

Die WG-Suche in München ist eine Tortur. Mit diesem Skript, das den Quadratmeterpreis pro Angebot ausrechnet, geht's ein bisschen einfacher.


Man benötigt dafür lediglich die Firefox-Erweiterung Greasemonkey.

Mittwoch, 14. Dezember 2011

Bash: Converting IPs to Hostnames within a file or stream

I recently stumbled upon an interesting problem.

Imagine you have many IP addresses in a file or piped input. How to reverse DNS these entries, that is, how to substitute them with host names?



Well... took me a few hours, but once again, Perl magic to the rescue:

cat file | perl -pe 'sub rep{$host=`host $_[0]`;$host=~'s#\\n##g';$host=~'s#\(.+\ \|\.$\)##g';return $host} s#([^0-9]+)?([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)#$1.rep($2)#eg';

So, for "LALALA---" you'd get "LALALA---google-public-dns-a.google.com---BLAAAAH---vnsc-bak.sys.gtei.net---LALALA".

Cool or cool?

Mittwoch, 16. Februar 2011

Teamspeak 3 Wav to Mp3

This is rather a note to myself. If you try to convert a wav-file with Lame, which had been written by Teamspeak 3, you'll probably encounter the following error:

Unsupported data format: 0x0003

One solution is, to resample it with Sox:

sox ts3.wav -b 16 -r 44100 converted.wav

Now, you may convert it with lame (or oggenc):

lame -V9 converted.wav final.mp3

or directly by piping:

sox ts3.wav -b 16 -r 44100 -t wav - | lame \
-V9 - final.mp3

I've chosen -V9 since that voice quality was still good for me. The original file had 906 MB, the other wav (generated by Sox) had 417 MB. I finally got mp3's of 18 MB (with -V9) and 26 MB (with -V8).