Nicolás Brailovsky


A modern blog

Archive for October, 2008

Splitting flac and ape files in Debian / Ubuntu

author Posted by: nico on date Oct 28th, 2008 | filed Filed under: Linux

I keep forgetting this one, so I’ll keep it here.

What to do when you get a cue file with a single huge flac file, or even worse, an ape file? With the right packages it’s an easy task (getting the packages right may be hard tough).

There are three parts to this problem: getting the ape file to a more user friendly format (flac), splitting it and then renaming the splitted files.

Needed packages

  1. wget http://members.iinet.net.au/~aidanjm/mac-3.99-u4_b3-1_i386.deb && \
  2.    sudo dpkg -i mac-3.99-u4_b3-1_i386.deb && \
  3.    rm -f mac-3.99-u4_b3-1_i386.deb

Source: http://aidanjm.wordpress.com/2007/01/26/using-monkeys-audio-ape-files-in-ubuntu/

Now install cuetools:

  1.  sudo apt-get install cuetools

Splitting the file

  1.  cuebreakpoints *.cue|shnsplit *.ape -o flac

Renaming the splitted parts

In the cue file there should be a list of the original file names. I hacked a script to parse & rename the files from the previous step, you can get it here: cue-rename

For this script to run you’ll need php-cli package. Just run it in the same folder the cue file is, as any other bash script. There’s a flag to get a preview instead of a complete rename; it’s somewhere in the file and I don’t have much plans to clean it up anytime soon. Drop me a line if you do.

Back online!

author Posted by: nico on date Oct 27th, 2008 | filed Filed under: Meta-post

Ruby: Method chaining

author Posted by: nico on date Oct 16th, 2008 | filed Filed under: Programming

Interesante :)

  1. #!/usr/bin/ruby1.8
  2.  
  3. module MethodDecorator
  4.   # Create a chain between methods:
  5.   #   Rename org_mthd to org_alias and then point it to new_mthd
  6.   # The next time org_mthd is called new_methd will be executed
  7.   def add_chain org_mthd, new_mthd, org_alias
  8.     self.class.class_eval do
  9.       (alias_method org_alias, org_mthd) unless method_defined? org_alias
  10.       alias_method org_mthd, new_mthd
  11.     end
  12.   end
  13.  
  14.   # Extremly evil code ahead!
  15.   def decorate method, decorator
  16.     # Create a chain counter if it doesn’t exist
  17.     @chain_counter ||= 0
  18.     # Use the chain counter as a method id
  19.     i = (@chain_counter += 1)
  20.  
  21.     # Create a new method which will dispatch the call to both
  22.     # the original and the decorator method
  23.     self.class.class_eval <<-EOM
  24.       def chain_dispatcher#{i} *params
  25.         #{decorator} *params
  26.         chain_original#{i} *params
  27.       end
  28.     EOM
  29.  
  30.     # Once the method was created, add chain
  31.     eval "add_chain method, :chain_dispatcher#{i}, :chain_original#{i}"
  32.   end
  33. end
  34.  
  35. class Foo
  36.   include MethodDecorator
  37.   def foo; print "Hello "; end
  38.   def bar; print "world\n"; end
  39.   def initialize; decorate :bar, :foo; end
  40. end
  41.  
  42. Foo.new.bar

Ahora si, tengo que buscar ya un plugin para código.

Edit: Agregado el plugin para código!

Lyx

author Posted by: nico on date Oct 15th, 2008 | filed Filed under: Linux, My Articles

Continuando el post sobre aplicaciones necesarias para un nuevo sistema, un review que escribí hace tiempo sobre Lyx, un frontend para LaTeX:

http://debaday.debian.net/2008/01/20/lyx-a-text-editor-that-stays-out-of-the-way/

(Tip: hay una versión para Windows)

author Posted by: nico on date Oct 10th, 2008 | filed Filed under: Meta-post

// TODO

Add a CODE tag

apt-get new computer

author Posted by: nico on date Oct 9th, 2008 | filed Filed under: Linux

Siempre me olvido cuales son los paquetes copados para instalar en un nuevo sistema así que voy a copiarlo acá. Después pongo links a cada aplicación.

# APPS
apt-get install mozilla-thunderbird lyx

# DPOTD cool apps
apt-get install tilda mmv unclutter katapult moc

# DPOTD SA tools
sudo apt-get install knetworkmanager xdiskusage iptraf sshfs apt-listbugs

# Media stuff: flv player, shnsplit/cuebreakpoints (flac), winrar
apt-get install ffmpeg shntool cuetools flac wavpack unrar vlc

# Reading APE files (not recommended, though)
# cuebreakpoints *.cue|shnsplit -o flac *.ape
# http://aidanjm.wordpress.com/2007/02/15/split-lossless-audio-ape-flac-wv-wav-by-cue-file/
# http://aidanjm.wordpress.com/2007/01/26/using-monkeys-audio-ape-files-in-ubuntu/
wget http://members.iinet.net.au/~aidanjm/mac-3.99-u4_b3-1_i386.deb && \
sudo dpkg -i mac-3.99-u4_b3-1_i386.deb && \
rm -f mac-3.99-u4_b3-1_i386.deb

# Conky, sensores y plugins
apt-get install conky libxext-dev lm-sensors build-essential checkinstall wmctrl

# Servers y script dev
apt-get install apache2 php5 mysql5-server rails ruby

# Headers y demas (incluye X11)
apt-get install libc6-dev libstdc++6-4.1-dev g++-4.1 g++ dpkg-dev build-essential x11proto-core-dev linux-libc-dev libxau-dev libxdmcp-dev x11proto-input-dev x11proto-xext-dev x11proto-kb-dev xtrans-dev libx11-dev libxext-dev glibc-doc libgtk2.0-doc manpages-dev

# Headers para php
ant php5-dev ant-optional m4 autoconf autotools-dev automake1.4

# Ecplise con CDT
apt-get install java-common libswt3.2-gtk-jni libswt3.2-gtk-java eclipse-rcp liblucene-java liblucene-java-doc libjsch-java libservlet2.4-java libcommons-el-java java libcommons-collections-java java libcommons-logging-java java libcommons-launcher-java liblog4j1.2-java libregexp-java libbcel-java libmx4j-java libcommons-collections3-java libcommons-beanutils-java libcommons-digester-java libcommons-modeler-java libcommons-pool-java libcommons-dbcp-java libtomcat5.5-java eclipse-platform junit eclipse-jdt eclipse-pde exuberant-ctags eclipse-cdt mlock libc-client2002edebian zlib1g-dev libssl-dev eclipse libtld3 odbcinst1debian1 unixodbc sun-java5-bin

self.start

author Posted by: nico on date Oct 9th, 2008 | filed Filed under: Meta-post

Superado el primer post casi obligatorio, ¿de que se trata todo esto?

Planeo volcar acá todo tipo de locuras que se me ocurran, muchas de las cuales estarán dedicadas a la informática. Prometo mantener al mínimo los meta-posts.

El contenido estará mayormente en español pero como las estadísticas muestran hits de otros lados (yo tampoco me explico cómo) algunas cosas irán traducidas.

With obliged frist post out of the way, what’s all this about?

I’m planning to dump here all kind of crazy ideas I can think of, many of which will be about computing. I promise to keep meta-posts to a bare minimum.

The content will be mainly in Spanish but as the statistics show hits from some other places (I have no idea why neither) some things will be translated.

Bonus points para quien adivine de donde saqué la imagen.

etc/init.d/blog start

author Posted by: nico on date Oct 4th, 2008 | filed Filed under: Meta-post

First post!!1