MW

Tag linux - page 13

Recent Posts

Attack of the shell helpers (March 03, 2009)

Everyone who uses the command line regularly has a bunch of (at least for him) useful helper scripts. I now took the liberty to put mine on github for general consumption.

You can find them at: http://github.com/milianw/shell-helpers/tree/master

Some of these might be more useful than others, you decide :) Personally, I can’t live without the following:

apupgrade

a shortcut to update your Debian system with one command - no questions asked `openurl`

opens a given URL in an already opened browser instance or starts a new browser session. Not only one browser is checked. I use it because firefox is slow to start and konqueror is blazingly fast to start. But when firefox is already open I want to use that. `xerr`

shortcut for fast error checking in your Xorg log `clipboard`

makes KDE4 Klipper contents available on the CLI (read _and_ write access!) `debug`

shortcut to start a GDB session: debug APP APP_ARGS is all you have to do. Its basically the same as doing:

continue reading...

Download script for springerlink.com Ebooks (December 20, 2008)

After a long period of silence I present you the following bash script for downloading books from http://springerlink.com. This is not a way to circumvent their login mechanisms, you will need proper rights to download books. But many students in Germany get free access to those ebooks via their universities. I for example study at the FU Berlin and put the script in my Zedat home folder and start the download process via SSH from home. Afterwards I download the tarball to my home system.

Read on for the script.

Download the script (attached below), push it to your Zedat account, make it executable and run it. You’ll have to give it a link to a book-detail page like this one for example. Also take a look at the example call at the top of the script.

Requires bash, wget, iconv, egrep.

Note: Take a look at the comments, Faro has come up with an updated Bash script which properly handles ebooks which span multiple pages on SpringerLink and merges the pdf-files with pdftk. Thanks Faro!

continue reading...

mp3dump: Rip the audio stream of a Flash video to MP3 (November 26, 2008)

UPDATE : Also check out mp3dump part 2

On some undefined occasion you might want to dump the audio stream of a flash file. This is how you do it:

  1. Get the *.flv, e.g. visit youtube with Konqueror and check /tmp for a file like FlashV5SQLt - this is your FLV.
  2. Install some dependencies: ffmpeg is required, mp3info and ecasound are optional but strongly recommended.
  3. Download the script below (it’s attached!) and save it inside your $PATH, remember how you’ve called it!
  4. I’ve saved the script inside ~/.bin which is inside my $PATH so all I have to do now is running it:

mp3dump FlashV5SQLt "Foo Bar" "All Your Base Are Belong To Us"

This would rip the audio stream of FlashV5SQLt to a file named Foo Bar - All Your Base Are Belong To Us.mp3 - with emulated stereo sound and basic MP3 tags (artist and title). Coolio!

So what does this neat-o-bash-magic look like?

Note: The script is attached below, so no copy’n’paste is required (but optionally supported :-) )

    #!/bin/bash
    #
    # Simple script to rip the audio stream of a FLV to MP3
    #
    # usage:      mp3dump INPUT.flv ARTIST TITLE
    # example:       mp3dump FlashhxSjv3 "Foo Bar" "All your Base are Belong to Us"
    # Author:        Milian Wolff
    # depends on:  ffmpeg
    #   optional:    ecasound for stereo sound emulation
    #   optional:   mp3info to write title and artist mp3 tags
     
    if [[ "$(which ffmpeg)" == "" ]]; then
     echo -e "\033[41mInstall ffmpeg or this script wont work!\033[0m"
        exit
    fi
     
    if [[ "$1" == "" || "$2" == "" || "$3" == "" || "$4" != "" ]]; then
      echo "Usage: $(basename $0) INPUT.flv ARTIST TITLE"
      exit
    fi
     
    dest="$2 - $3.mp3"
    tmpfile="/tmp/$$-$dest"
     
    echo "Destination file is: $dest"
    echo
    echo
     
    echo "generating mp3 file..."
    echo
    ffmpeg -i "$1" -f mp3 -vn -acodec copy "$dest" 1>/dev/null
    echo
    echo -e " \033[32mdone\033[0m"
    echo
     
    if [[ "$(which ecasound)" == "" ]]; then
     echo "You can optionally install ecasound to simulate stereo sound"
      echo
    else
      echo -n "simulating stereo sound..."
     
        ecasound -d:1 -X -i "$dest" -etf:8 -o "$tmpfile" 1>/dev/null
        mv "$tmpfile" "$dest"
     
     echo -e " \033[32mdone\033[0m"
       echo
    fi
     
     
    if [[ "$(which mp3info)" == "" ]]; then
      echo "You can optionally install mp3info to write basic mp3 tags automatically"
      echo
    else
      echo -n "writing basic mp3 tags..."
     
     mp3info -a "$2" -t "$3" "$dest"
     
     echo -e " \033[32mdone\033[0m"
       echo
    fi
     
    echo "Have fun with »$dest«"

continue reading...

recent GeSHi contributions (apache, xorg, apt, performance, ...) (June 18, 2008)

Your favourite syntax highlighter for web applications, GeSHi, recently got some new features and bug fixes. By yours sincerely. A rough summary of what I contributed:

  • various performance improvements, i.e. some speed optimizations and reduced memory consumptions (especially peak memory usage is down by roughly 1MB when highlighting geshi.php by itself)
  • minor bugfixes, including one which prevents some nasty PHP notices on PHP 5 systems to contaminate your precious log files
  • improved language files: bash, apache
  • added language files: GNU Gettext, Xorg configuration and Apt sources.list

Some of those features were already shipped with the recent 1.0.7.22 release. But the two new language files and the improvements to the existing apache language file are currently only available via SVN. Wait for the next stable release which should be 1.0.8.

continue reading...

LinuxTag Day One (May 28, 2008)

Like last year I’m again standing at the Kubuntu Community booth at this years LinuxTag. Just now I’ve attended the keynote held by Aaron Seigo, ambassador of the KDE project. It was a very interesting talk which covered topics like Internet-Mobile-Desktop interaction, security, effects, Nokia and more. The most important parts roughly listed are:

  • you’ll one day be able to use the same (KDE) applications everywhere - Marble and Plasma for example already just compile and work on mobile devices
  • the internet will get much more embedded into your everyday applications. Marble with OpenStreetMap & Wikipedia support or Amarok with its storage backends (Lastfm, Jamendo etc. etc.) are good examples in this regard.
  • KDE4 is much more accessible than KDE3 thanks to QAccessible
  • security and privacy is not forgotten! This is free software, don’t forget that. Plasma Applet packages will get GPG signed (just like the DEB packages in Apt). And you have control over what data is send where - no Stasi 2.0 here!
  • Nokia is actively supporting KDE, fear not! And of course never underestimate the power of the Free Qt Foundation.

continue reading...

mp3dump take two - better audio quality (April 08, 2008)

So just yesterday I’ve published a bash script which rips the audio stream of Flash Videos (*.flv) to mp3 format. It’s nice, fast and imo all-purpose. But I didn’t like the audio quality. Thus below you can find a second version of the script which is using mplayer and lame instead of ffmpeg. Usage and behaviour should be pretty much the same. Only the audio quality should be better on cost of a bit more computing.

Since it relies on the fact that the input *.flv video already uses MP3 encoding for its audio stream this might not work for every flash file! Youtube works just fine though. You can find the script after the break, it’s also attached below. For usage / installation / more information read the old article.

If you wonder why I reencode the audiodump with lame: The dumped mp3 file is considered by most (all?) audio players to be ~10x the length. A five minute video gets a 45 minute audio dumpfile. It plays fine but seeking is a mess. Reencoding fixes this. If you know an alternative which does not require reencoding or is generally faster - please drop a comment!

continue reading...

Patching Kirocker Music Display for volume control via mouse scrolling (March 28, 2008)

Kirocker is such a great application, it’s a pity the developer Sébastien Laoût has given up on it and is using Windows now!

Usually I only use the kicker applet, the full screen window is nice for parties though. But I didn’t like the way the applet handles scroll events: It seeks (if possible). Since I rarely seek when listening to music I’d rather have the behaviour of the Amarok tray icon: volume control!

I had a look inside the sources and found this part in src/coverdisplay.cpp:

    void CoverDisplay::wheelEvent(QWheelEvent *event)
    {
        if (areControlsShown()) {
          if (event->orientation() == Qt::Vertical) {
             PlayerInformation *infos = PlayerInformation::instance();
              if (infos->canSeek()) {
                 int deltaSeconds = 10 * (event->delta() > 0 ? 1 : -1);
                   m_infos->seekRelative(deltaSeconds);
                }
          } else {
               if (event->delta() > 0)
                  AmarokApi::volumeUp();
             else
                   AmarokApi::volumeDown();
           }
      }
    }

continue reading...

Reinstall Nvidia Driver (February 09, 2008)

For those of you, who use the original NVIDIA display driver and have to reinstall it with every kernel update: Here is a little bashscript for your convenience.

    #!/bin/bash
    sudo /etc/init.d/kdm stop
    sudo chvt 1
    sudo sh ~/Downloads/NVIDIA-Linux-x86-*.run --ui='none' -aNq
    sudo /etc/init.d/kdm start
    sudo chvt 7

Save it e.g. as ~/.bin/nv_reinst.sh, make it executable (chmod +x ~/.bin/nv_reinst.sh). Then put your NVIDIA driver (only the newest version please) into ~/Downloads/ (or change the path above). Now run your script.

Attention: Save all your work, since kdm will be stopped! You’ll lose all unsaved work!

continue reading...

Cedega and Sound (October 24, 2007)

If you’re cedega games don’t play sound when another program does some audio-ouput despite using ALSA don’t forget to change the CTL and PCM devices to “default”!

continue reading...

GPLv2 vs GPLv3 (September 30, 2007)

I came across a very interesting paper about “GPLv2 vs GPL v3” , subbed :

The two seminal open source licenses, their roots, consequences and repercussions

Analysing, understanding and interpreting the GPLv2 and GPLv3 licenses

Must read for every Linux user in my opinion!

Download it here:

http://www.linuxdevices.com/news/NS7621424054.html

continue reading...