Open gzipped file with vi?

If you are using latest (and greatest) vi/vim then it can open gzipped files (those with extension .gz) automagically, but it’s not so easy if you must use some old/outdated system where is also old vi/vim.

So, what to do? Gunzipping is sometimes impossible (no gunzip? not enough free space? readonly system? too many files to just search through…). Use zcat!

$ zcat filename.gz | vi -

That’s not all!
gzip package (on Gentoo : app-arch/gzip) contains many more commands useful with .gz files, for example:

* zcmp – binary-compare two gzipped files
* zdiff – compare two gzipped files
* zgrep, zegrep, zfgrep – grep in gzipped files
* zless, zmore – do less and more on gzipped files

Posted in Uncategorized | Leave a comment

KDE and empty “Open With…” menu

Updated to KDE 4.6.2 on one computer and weird problem happened. When tried automount usb disk and open it with dolphin instead I got dialog to choose program to do it with. Strange. Later discovered, that right-click on file “Open With” dialog was empty. Just like all mime-related info was gone.

To fix it, just remove /var/tmp/kdecache-[username] and just relogin to KDE.

Posted in Uncategorized | Leave a comment

Errors in wordpress after php upgrade

Got an interesting problem few days ago. Just updated php (and apache and some other programs) and did “/etc/init.d/apache2 graceful” when suddenly got errors in wordpress blogs like this

Warning: preg_replace() [function.preg-replace]: Compilation failed: unknown option bit(s) set at offset 0 in /path/to/wp-install/wp-includes/shortcodes.php on line 228

Code-repo showed that there were no changes for long time in shortcodes.php file, so there was like two possibilities – some new problem with php or some weird error in my server.

Got also two links from wordpress bugtracker

from where I found out, that it might be releated to libpcre. I created test.php with phpinfo(); inside and found out that php was using pcre 7.9 when in system was actually installed 8.12.

final step to discovery of problem was some page where some user complained, that he has different output of phpinfo(); in apache and on commandline. So, inspired of that, I checked out and got interesting result:

$ php --info|grep -i pcre
PCRE Library Version => 8.12 2011-01-15

also were both files pointing to right place

$ ldd /usr/bin/php | grep pcre => /lib/ (0xb7230000)


$ ldd /usr/lib/php5.3/apache2/ | grep -i pcre => /lib/ (0xb6aba000)

So, only possible explanation could be, that apache graceful restart was not enough. When I did restart, it complained about configuration (yeah, two changes in same time, bad-bad!) – ssl port was already taken), and when I fixxed apache start-flags it started and also showed php right pcre version and problem in wordpress dissapeared.

Posted in Uncategorized | 6 Comments

How to find out uptime in windows?

If you are looking answer for that, you will soon discover that there is no way to find out this from default GUI programs

Run this in “cmd” :

net statistics server

or shorter

net stats srv
Posted in Uncategorized | Leave a comment

vi: case insensitive search

By default, vi / vim searches are case sensitive. This mode can be toggled with next commands

:set ignorecase

or shorter version

:set ic

And turn case insensitive mode off again

:set noignorecase
Posted in Uncategorized | Leave a comment

Quick way to find out path’s in kernel config, part 2

As last time I wrote “how to find config locations” in kernel menuconfig, there is one more important thing to know. Sometimes kernel options are hidden (and they are even not greppable) because of dependencies.

For example, I tried to turn on CONFIG_USB_SUSPEND but didn’t find it where it shoult be. Here comes another site to help, in current case There you find depends on: line, and all you should to do is confirm, that those linked options are also enabled. ->

Posted in Uncategorized | Leave a comment

Linux and VirtualBox – no sound in guest OS

Recently something happened – when starting guest-os, I got error saying “No audio devices could be opened” :

and in log was such data:

00:00:05.542 Audio: Trying driver 'alsa'.
00:00:05.595 ALSA: Failed to apply audio parameters
00:00:05.595 HDAcodec: can't open in fmt(freq: 44100)
00:00:05.602 ALSA: Failed to apply audio parameters
00:00:05.608 ALSA: Failed to apply audio parameters
00:00:05.608 HDA: WARNING: Unable to open PCM IN!
00:00:05.608 HDA: WARNING: Unable to open PCM OUT!
00:00:05.608 Audio: Using NULL audio driver
00:00:05.608 VM: Raising runtime error 'HostAudioNotResponding' (fFlags=0x0)
00:00:05.608 Console: VM runtime error: fatal=false, errorID=HostAudioNotResponding message="No audio devices could be opened. Selecting the NULL audio backend with the consequence that no sound is audible"

After few weeks filled with recompiling and surfing I found this thread where I found hint about libsdl and and bug #26730 and #310793

It turns out, that there is conflict between how different software needs/wants to use some library. Although at first it seems, that problem is on gentoo’s and libsdl’s side, it is VirtualBox’es thing to fix.

Until it is not fixxed, one solution is not to use latest libsdl. Just add to /etc/portage/package.mask/monolithic following line:


and reemerge media-libs/libsdl package

Posted in Uncategorized | Leave a comment

Quick way to find out path’s in kernel config

You are (Gentoo) linux-user.
You are building packages by yourself.

How many times you have got message “X_Y_Z not enabled in kernel config”, like this (trying to emerge iotop):

 * Checking for suitable kernel configuration options...
 *   CONFIG_TASK_IO_ACCOUNTING:  is not set when it should be.

And sometimes it is pretty hard to find out, exactly where in “make menuconfig” referred config-option lays. Google can give some times answer as first item, sometimes it is not even on 10th page.

There is solution for that :
Just choose your kernel version (latest selected by default), and
arch at “Complete config for” and press “Go”

For example you get page like this. All config-options in one page (Help also available) and there you can search (in browser Ctrl+F) option you need and backtrace by indentations how to find it out from menuconfig.

Other, also very useful link is – Linux kernel code cross referenced (if you need to find out where is some type defined, just press link)

Posted in Uncategorized | 1 Comment

md5sum vs md5 – different algorithms?

Calculate md5 hash with md5sum, php, python and perl oneliners:

$ echo "hello" | md5sum 
b1946ac92492d2347c6235b4d2611184  -
$ php -r "echo md5('hello');"
$ python -c "import hashlib; print hashlib.md5('hello').hexdigest();"
$ perl -MDigest::MD5=md5_hex -e 'print md5_hex("hello") . "\n";'

And here will you have question – is md5sum (part of sys-apps/coreutils if you are using Gentoo) using some other algorithm to compute hash? Answer is no! It uses same algorithm, and problem lies not in md5sum itself but in echo.

Echo enters linebreak at the end of string. There is two solutions with echo command

$ echo -n "hello" | md5sum 
5d41402abc4b2a76b9719d911017c592  -
$ echo -e "hello\c" | md5sum 
5d41402abc4b2a76b9719d911017c592  -

In first case there is used parameter -n which says to echo – do not output the trailing newline.
In second case -e forces echo to accept backslash characters and \c ends output.

.. or use some other command to output string:

$ printf "hello" | md5sum 
5d41402abc4b2a76b9719d911017c592  -

.. or use md5sum in “read in” mode (after you have written ‘hello’ press Ctrl+D twice):

$ md5sum -t 
hello5d41402abc4b2a76b9719d911017c592  -

.. or write string into a file without linebreak:

$ md5sum password_file
Posted in Uncategorized | 2 Comments now officially online

just made change in old site’s config which is now redirected here.

Also added download directory for OpenSSL-GPU page with first/old version of code.

Posted in Uncategorized | Leave a comment