M y    b r a i n    h u r t s  !                                           w e                 r e a l l y                 t h i n k                   w h a t                y o u             k n o w

28 May 2009

M4AtoMP3: Convert M4A files to MP3

I wanted to convert some M4A files to MP3, and found some examples of how to do it: Convert iTunes M4A files to MP3 on Linux, and especially Howto:convert aac/mp4 to wav/mp3/ogg on Linux.

The second link was close to what I wanted, and the script almost worked, but I wanted something even simpler, so here is the simplest script that worked for me. It converts all .M4A files in the current directory to MP3.

# Usage: run without arguments from the folder containing M4A files
# Uses faad and lame (sudo apt-get install faad lame)
shopt -s nocaseglob

for file in *.m4a ; do
  if [ -e "${file%%.*}.mp3" ]; then
    echo "file ${file%%.*}.mp3 already exists! skipping!" ;
  faad -o - $file | lame - "${file%%.*}.mp3" ;

22 May 2009

Screen Quick Howto

What is screen?
man page: "Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells)." Here is a screen screen tutorial.
Screen quickref
Most of the data below has been taken from the screen quick reference.
Change to last-visited active window
C-a C-a (commonly used to flip-flop between two windows)
Change to window by number
C-a <number> (only for windows 0 to 9)
Change to window by number or name'
C-a <number or title>
Change to next window in list
C-a n or C-a <space>
Change to previous window in list
C-a p
Split current screen session into two regions
Remove current region
C-a X
remove all regions but the current one
C-a Q
Switch between displayed regions
Create new session in split region
C-a c
Return to a single region
C-a Q
C-a d
Detach and logout (quick exit)
C-a D D
Enter copy mode
C-a [ (also used for viewing scrollback buffer) and with C-]
C-a ]
Rename current window
C-a A (note the uppercase 'A'!)
Console commands
Detach attached session
screen -D
Detach attached screen session (possibly running in another terminal) and reattach in current terminal
screen -Dr
Detach specific screen session (when more than one sessions are running)screen -D 14493.ssh2others
Move cursor to beginning of lineControl+a (release Control) + a