Convert mp3 tags encoding

I need to change the language encoding of some mp3 files, because they are not displayed properly in Clementine. The song names and albums are in Cyrillic, so I wanted to convert all tags text to CP1251. I googled around and found the solution here. I decided to use the mid3iconv method. I installed mutagen from SBo, and executed the following in the folder with the files:

find . -name "*.mp3" -print0 | xargs -0 mid3iconv -e CP1251 -d

The music in question is Nautilus Pompilius – MP3 КОЛЛЕКЦИЯ. The disc contains several albums and is sold as an mp3 collection.

Leave a comment

Filed under media

Batch resize of pictures

I had generated graphics from the Simple Modular Architecture Research Tool (S.M.A.R.T.) in the highest possible resolution. However, later on I needed to scale down the graphics.

How to do that? I searched a bit and I found these explanations about the convert command, part of Imagemagic. Very useful tips there, however I needed something that will batch process a bunch of picture files. The command mogrify, also part of Imagemagic, is what I needed.

Just go to the folder with the pictures and do:

mogrify -resize 50% *

This will resize in half everything in the current folder, overwriting the original files. In case, you may need the original files later, better back them up. Also, Imagemagic comes with the standard Slackware installation.

Leave a comment

Filed under Academic, media

Firefox: disable the built-in PDF viewer

When the built-in PDF viewer arrived for Firefox, I was quite excited. However, I have to admit that it does not always work well. Sometimes fonts look weird and pictures distorted.

If it does not work well enough — let’s disable it! I searched and found the answer here. Open about:config and set the following to True:

pdfjs.disabled

Now, to make Firefox embed my preferred PDF viewer, I installed mozplugger from SBo. Its configuration file is /etc/mozpluggerrc and the PDF settings start at line 219 for this release (version 2.1.4). Edit to your liking, but even xpdf works very nicely, embedded into Firefox.

You may need to do one last thing. Go to Edit > Preferences > Applications, search for PDF and make Firefox use MozPlugger:

Screenshot - 09252014 - 08:14:04 PM

That’s it. Restart the browser if settings do not take effect.

By default, Adobe Acrobat (acroread) is commented out in /etc/mozpluggerrc. Since this is the particular PDF viewer I like to use, I uncommented it and proceeded as described previously. The instructions are for Seamonkey, but the steps work analogously for Firefox.

Leave a comment

Filed under network, office, SlackBuilds

Converting html

I need to convert a simple webpage to PDF and picture format. Usually, I would just take a screenshot, however it is too big. I searched and I found a nice little tool, called wkhtmltopdf. It can be easily installed from SBo. To convert a webpage to PDF, using default settings, is extremely easy. Just do the following in the terminal:

wkhtmltopdf example.html example.pdf

I was pleasantly surpised to find an additional program in the package, called wkhtmltoimage. It does what the name suggests — converts your html file to an image. Its use is also very easy:

wkhtmltoimage --format png --quality 100 example.html example.png

The above command will convert the html file to png, with high quality (100). Very nice!

Leave a comment

Filed under misc, office

GenomeTools

I need to export gene coordinates and exon organisation as a figure. I have prepared the annotations in UniPro Ugene, which I have installed from SBo. A nice tool for graphical representation of such data is provided by the GenomeTools software. It can be easily installed from SBo, too.

So, what is the strategy?

First, in UniPro Ugene select the annotations you want to export, right click and go Export > Export annotations. Then, select the gff format for the exported file, e.g. “example.gff“.

Now, it’s time to convert example.gff to graphics with the help of GenomeTools. Open up a terminal, navigate to the folder where the example.gff file is and execute the following command:

gt sketch -format svg -style my.style -start 1 -end 40000  output1.svg example.gff

Detailed explanations and instructions can be found in the corresponding section of the GenomeTools web-site.  Brief explanation below:

  • gt sketch will use the AnnotationsSketch library to create a drawing
  • -format svg specifies the drawing to be a SVG. Other formats include PNG, PDF or PostScript
  • -style my.style tells the program to use a custom style file
  • -start 1 -end 40000 tells the program to render a sketch between nucleotides 1..40000
  • output1.svg is the name of the output file
  • example.gff is the name of the input, annotations file

Therefore, this will create a SVG output file from example.gff, called output1.svg, using a custom style for the region between nucleotides 1..40000.

The SVG file can be additionally edited with Inkscape, if necessary. And here’s an example of what GenomeTools can do (from the program’s site):

annotation

Beautiful, isn’t it?

Leave a comment

Filed under SlackBuilds, Academic

Clearing syslog

Due to some reason, my /var/log/syslog had grown over 500MB. Since I have /var mounted to a separate partition I noticed it easily. I had never had such an issue, so I googled around and found this very old post. Decided to give it a try and just renamed the file and restarted syslog as it says:

mv /var/log/syslog{,.`date +%Y-%m-%d`}
kill -HUP `cat /var/run/syslogd.pid`

I saved the old syslog to another partition so I can check it later (still haven’t done it) and see what the problem was.

importantI just want to make it very clear, that I do not know if this is harmless.

So far I don’t seem to have any issues.

Leave a comment

Filed under misc, system

Amino acid sequence as a column

I need to present an amino acid sequence as a column, so I can paste it in a spreadsheet document (to serve as a reference to other analyses). There is a relatively straightforward way to do this. I have EMBOSS suite and the associated EMBASSY installed from SBo. I used the tool called SHOWPEP, with sequence only display format:

showpep

 

And below, from the Advanced Options, I set “Width of sequence to display” to 1:

showpep1Press the GO button and it’s done. Now you can just copy and paste it.

Great!

Leave a comment

Filed under Academic

Sound in Skype 4.3

Since version 4.3, Skype for Linux requires PulseAudio. It is available from SBo, but since Skype is a 32bit program only, the necessary 32bit compatibility packages should be installed as well. I am running Slackware64 14.1 -multilib system and I have a virtual machine with Slackware 32. So what I did was:

First of all, PulseAudio needs its own group and user. You can add them like this:

# groupadd -g 216 pulse
# useradd -u 216 -g pulse -d /var/lib/pulse pulse

In the virtual machine, I compiled the following from SBo:
speex | an audio compression format designed for speech
json-c | JSON library in C
pulseaudio | PulseAudio Sound Server

I converted the m to compat32 packages on my host machine like this:

convertpkg-compat32 -i speex-1.2rc1-i486-3_SBo.tgz -e tgz

In case you have no virtual machine at hand, you can use sbotools which is capable of creating compat32 packages from SlackBuilds.org, like this:

sboinstall --compat32 speex

However, with the above approach, the compilation of pulseaudio broke.

Then, I compiled the above packages on the host x86_64 system and installed them together with the ready compat32 packages and Skype. This worked for me right away. I had sound notifications, could hear the Skype test call and was able to record a message and hear it back.

There has been an active discussion about it on LQ where people reported various problems. There were also many suggestions, solutions and a user even prepared packages. From reading the discussion, I decided to configure an un-intrusive set up of PulseAudio. Following the Arch Linux Wiki article, I modified these files as suggested:

/etc/pulse/daemon.conf | Replace these with the proper values:

exit-idle-time = 0 # Exit as soon as unneeded
flat-volumes = yes # Prevent messing with the master volume

/etc/pulse/client.conf | Replace these with the proper values:

# Applications that uses PulseAudio *directly* will spawn it,
# use it, and pulse will exit itself when done because of the
# exit-idle-time setting in daemon.conf
autospawn = yes

/etc/pulse/default.pa | Replace the entire content of this file with this:

.fail
    # Set tsched=0 here if you experience glitchy playback. This will
    # revert back to interrupt-based scheduling and should fix it.
    #
    # Replace the device= part if you want pulse to use a specific device
    # such as "dmix" and "dsnoop" so it doesn't lock an hw: device.
    
    # INPUT/RECORD
    load-module module-alsa-source device="default" tsched=1
    
    # OUTPUT/PLAYBACK
    load-module module-alsa-sink device="default" tsched=1 
    
    # Accept clients -- very important
    load-module module-native-protocol-unix

.nofail
.ifexists module-x11-publish.so
    # Publish to X11 so the clients know how to connect to Pulse. Will
    # clear itself on unload.
    load-module module-x11-publish
.endif

To be honest, I don’t know it this helps or makes things better…

Leave a comment

Filed under desktop, media, multilib, network, SlackBuilds, system

Multirow bookmarks toolbar for Firefox

Over the years, the amount of bookmarks that I like to keep in my toolbar has grown and they no longer fit n a single row. I searched a bit and found this very useful Firefox add-on, called Roomy Bookmarks Toolbar. It does exactly what it’s description says and does it well.

Once installed, I tweaked its settings (Tools > Add-ons > Preferences), to show only one row, which can be scrolled with the mouse wheel:

Screenshot - 08082014 - 08:59:56 PM

There was a glitch, that made the toolbar display a cut off part from the row beneath it. This was easily fixed by the following option:

Screenshot - 08082014 - 09:00:37 PM

Works like a charm!

Leave a comment

Filed under misc, network, office

Run an application with a specific GTK2 theme

I want to run an application with a GTK2 theme that is different from the global one. Searching the Arch Linux wiki, pointed me to their solution.

In my case, I am running Slackware64 14.1 with KDE 4.10.5. I am using the Oxygen QT4 theme and its GTK2/GTK3 ports that come with Slackware by default (oxygen-gtk2 and oxygen-gtk3). However, as mentioned before, I am experiencing problems with certain applications. Among them is the Zotero bibliography manager. A nice, Oxygen-like theme for GTK2 that does not have these issues is kde44-oxygen-molecule, available from SBo.

In order to use this theme only for Zotero, I copied /usr/share/applications/Zotero.desktop locally to ~/.local/share/applications/. Then, I edited the Exec line of the local copy of the .desktop file as the Arch Linux wiki recommended:

Exec=GTK2_RC_FILES=/usr/share/themes/kde44-oxygen-molecule/gtk-2.0/gtkrc zotero %f

Save and it runs without problems (so far). It looks a little different compared to the rest of the desktop but it does not bother me that much. Yet.

Leave a comment

Filed under desktop, system