Mittwoch, 26. Juni 2013

Convert APE to FLAC in Ubuntu 13.04 using Libav

If you have a file in the lossless APE format and want to convert it without installing the MAC codec, you can easily do this in Ubuntu using Libav.

Just install av tools:

sudo apt-get install libav-tools

and convert the your file/s:

avcon -i inputApeFile.ape outputFlacFile.flac


That's one easy of many ways to convert APE files in Ubuntu.

Freitag, 21. Juni 2013

Reset Ubuntu Home Dir Permissions

In case you messed up the permissions of you home dir. Here is a small guide to fix it:

1. Reset the permissions for the directories recursivly:

sudo find /home/user/ -type d -exec chmod 755 {} \;

2. and the permissions for all files too:

sudo find /home/user/ -type f -exec chmod 644 {} \;

3. Ensure that your GPG directory has the proper permissions:

sudo chmod -R 600 .gnupg/
sudo chmod 700 .gnupg/

If you don't want that other users can read your home folder (which not default in Ubuntu) change it's permission also:

sudo chmod 700 /home/user

That's it. Not that hard, if you know the right commands.

Mittwoch, 12. Juni 2013

Check MD5 and SHA1 sum for a file in Ubuntu Linux

Imagine you have a file to download with a given checksum and you want to make sure that the file is not corrupted after download.



It's really easy to compute and check the MD5 sum in Ubuntu / Linux using the terminal:

md5sum myFileToCheck

and for SHA1 checksum:

sha1sum myFileToCheck
Both commands compute the corresponding checksum of your file, so you can compare than with the original checksums.

Donnerstag, 30. Mai 2013

Check and repair LUKS encrypted partitions in Ubuntu 13.04

Unfortunately Gnome Disks was castrated in version 3.6, it is now impossible to repair LUKS encrypted filesystems with the help of Gnome Disks. But you can easily do this within the terminal.

If you are using a LUKS encrypted partition and you want to check whether it has file system errors, you can do this with the following commands:

  1. Mount and open your LUKS partition:

    sudo cryptsetup luksOpen /dev/<yourPartition> <someMountName>

    e.g.: sudo cryptsetup luksOpen /dev/sdb3 foo
  2. Run fsck on it to check and auto-repair the filesystem:

    sudo fsck -a /dev/mapper/<someMountName>

    e.g.:  sudo fsck -a /dev/mapper/foo
  3. After the check / repair is finished, do not forget to close your LUKS volume again:

    sudo cryptsetup luksClose <someMountName>

    e.g. sudo cryptsetup luksClose foo
If you want to avoid an auto-repair and instead want to do a user guided check / repair, just remove the "-a" option.

That's it easy peasy, isn't it ?

Freitag, 24. Mai 2013

Install latest Homerun version in Kubuntu 13.04

Install latest Homerun version in Kubuntu 13.04



Just a small tutorial how to build and install the latest version of Homerun in Kubuntu 13.04 as the PPA is slightly outdated:
  1. Get the latest stable release and extract it or get the git snapshot (via git clone git://anongit.kde.org/homerun)
  2. Install necessary dependencies: 

    sudo apt-get install libkonq5-dev kde-workspace-dev kdelibs5-dev
  3. Go into folder:

    cd homerun

  4. Create build directory and go into it:

    mkdir build; cd build
  5. Build it:

    cmake -DCMAKE_INSTALL_PREFIX=`kde4-config --prefix` ..

  6. Compile it:

    make
  7. Install it:

    sudo make install
  8. If you already run an older version of Homerun killit and restart homerun:killall homerunviewer; homerunviewer

There we go ! You can easily remove it via sudo make uninstall from install dir.

Donnerstag, 2. Mai 2013

R mit PostgreSQL unter Ubuntu 12.04

Hier die ultimative Übersicht für alle die gerne mit R unter Ubuntu arbeiten und Daten aus PostgreSQL verwenden möchte. Ich geh davon aus, dass die PostgreSQL-Datenbank jeder allein einrichten kann.


  1. Schritt: Abhängigkeiten (PostgreSQL, JDBC-Connector für PostgreSQL und R) installieren
    sudo apt-get install postgresql libpostgresql-jdbc-java r-base-core r-cran-rjava r-cran-dbi 
  2. Schritt: Terminal öffnen & R starten mit
    R
  3. Schritt: JDBC-Paket (RJDBC) für R installieren
    install.packages(c("RJDBC"))
  4. Schritt: Verbindung zur Datenbank aus R herstellen
    # JDBC-Paket einbinden
    library(RJDBC)

    # JDBC-PostgresSQL-Treiber initialisieren
    drv <- JDBC("org.postgresql.Driver", "/usr/share/java/postgresql-jdbc4-9.1.jar", identifier.quote="`")

    # Verbindung zur Datenbank herstellen
    conn <- dbConnect(drv, "jdbc:postgresql://localhost/datenbank", "user", "pw")
    # SQL-Query ausführen
    data <- dbGetQuery(conn, "select * from iris where Species='setosa'")
  5.  Fertig :) 
Bei Verbindungen zur nicht lokalen Datenbanken muss der dbConnect-Aufruf angepasst werden.