Atom feed

Make your life easier with "cd" in a bash script

Why the need of this?

Let's assume you want to write a script that would allow you to navigate faster between your most frequently used directories. And let's take my everyday problems as an example. I have a similar directory structure:

~/studies/
     semester1/
         subject1/
         subject2/
         ...
     semester2/
         subject1/
         subject2/
         ...
     ...

Every time I want to cd to one of these directories I have to write something like:

cd ~/studies/semester4/subject2

which is a little pain in the arse if I have to do this many times (and I have to). And no, using Nautilus or Thunar or D...

» read more

Openbox on Arch: file associations

Configuring file associations is easy if you're using a full-featured desktop environment, such as KDE, Gnome or Xfce. In such case, xdg-open delegates the task of opening file to kde-open, gnome-open or exo-open, depending on the environment. But with Openbox and similar environments it's not that easy.

It's likely that when you click on a just downloaded PDF file, it opens in Firefox and not in Evince or Okular (or your any PDF-reader of choice), because xdg-open defaults to Firefox.

One possible solution is to install a part of KDE, Gnome or Xfce environment, and use one of the *-open family. But we'll try a more "pure" solution.

Creating list of default applicati...

» read more

Image concatenation with Imagemagick

Concatenation of multiple images can easily be done with tools such as GIMP, but easily doesn't always mean fast. So let's assume that we want to tile some images, e.g. to create an image sprite we will use on our webpage. And assume we want to do it fast.

So, instead of copy-pasting all images into the sprite, or opening them all as layers and moving them, and opening, and moving, and so on, we're going to use a command line tool, that will do all the work for us.

We will use an extremely powerful tool: Imagemagick, so if you don't have it installed yet, please do it now.

The simple way

The convert program with _ap...

» read more

Intel KMS and setting correct DPI in xorg-server-1.7.*

Today I switched from xorg-server-1.6.5 to xorg-server-1.7.6, as it is now available in portage and considered as stable.

Paweł Hajdan's advice, I've found on Planet Gentoo, allowed me to avoid all the driver problems, such as broken keyboard or touchpad.

But major xorg-server update without any problems would be boring, wouldn't it? ;)

Awfully small fonts

After the update all fonts became smaller and much harder to read and didn't look much better after increasing font size in Openbox, GTK, etc... And changing font sizes everywhere is clearly the opposite of a go...

» read more

Normal distribution and histogram in R

I spent much time lately seeking for a tool that would allow me to easily draw a histogram with a normal distribution curve on the same diagram. I could create the histogram in OOCalc, by using the FREQUENCY() function and creating a column chart, but I found no way to add a curve, so I gave up. I started searching for something more powerful than OpenOffice. Of course, no Windows applications were allowed.

I googled my problem up before trying to use Maxima or something similar, and I found R. I haven't heard about the R project earlier, but I decided to give it a try. And it was worth trying. Even if I were able to do the same i...

» read more

Fixing broken Python on Gentoo with Paludis

Have you ever run a script that should do some things you wanted it to do, but instead you ended up with your system partially messed up? Unfortunately, such things do happen.

I have no idea how simple setup.py script could destroy Python libraries, but Gentoo with messed up Python (and furthermore, with unusable Portage) didn't seem to be useful. So I had to find a solution.

The first attempt

It would be great, if I could just simply re-emerge dev-lang/python-2.6.*, but as I already said, portage was broken.

I tried to reinstall Python manually, but with no luck. Python 2.5, other portage versions, etc. - still no luck.

I decided not to use a LiveCD, because fixing it with...

» read more

And developer said: "Let there be a website"...

...and there was a website.

So.. uhm..

It's intended to be, as the header says, my place on the web, and (as the header doesn't say) my little playground. A place to write about some topics that I have on my mind, and, by the way, a place to test some Ruby on Rails features in production environment.

Of course, current version of this site has some flaws and drawbacks. I'll try to improve it over time, because some features (such as RSS, better blog URLs, OpenID auto-registration, etc.) are still missing.

It's also possible that some of the features I'm going to implement, will be interesting enough to write a few words about them, and post them on this blog.

Time will tell, w...

» read more