GDB Hex Display

I always forget how useful that is, so writing it here:

x (for "examine") examines memory in several formats

x/nfu addr
x addr

n, f, and u are optional parameters that specify how much memory to display and how to format it;
addr is an expression where to start displaying memory. 

n, the repeat count
Decimal integer; the default is 1. It specifies how much memory (counting by units u) to display.

f, the display format
One of the formats used by print, 's' (null-terminated string), or 'i' (machine instruction). The default is 'x' (hexadecimal) initially. The default changes each time you use either x or print.

u, the unit size
The unit size is any of
    b - bytes.
    h - half words (two bytes).
   w - words (four bytes). This is the initial default.
   g - giant words (eight bytes).



Setup for GitHub

Fresh Linux installation, setup for GitHub:

> ssh-keygen -t rsa -b 4096 -C ""
(add it to GitHub profile)
> gpg --gen-key
(RSA, 4096)
> gpg --list-keys
pub   4096R/C077F67D 2016-05-03
> gpg --armor --export C077F67D
(add it to GitHub profile)

> git config --global "github-username"
> git config --global ""

> git config --global push.default simple

> git config --global checkout
> git config --global alias.b branch
> git config --global alias.c commit
> git config --global status
> git config --global alias.stage 'add -A'
> git config --global alias.unstage 'reset HEAD --'
> git config --global alias.last 'log -1 HEAD'
> git config --global alias.visual '!gitk'
> git config --global 'log --oneline --decorate'
> git config --global alias.ll 'log --oneline --decorate --graph --all'
> git config --global alias.r 'remote -v'

> git config --list
(review it all)

Install Virtual Box Additions on Fedora 14

I have been using Fedora 14 as my primary work desktop for a while. I like it a lot for many reasons and one of them that it easily runs as a virtual machine.

Oracle Virtual Box version 4 has been my choice for running desktop virtual machines because it is fast, robust, simple and free.

Anybody who runs Fedora knows it gets lots of updates and when such update includes the kernel then I have to reinstall Virtual Box Guest Additions that enable several important features with two I use all the time: mouse integration and shared folders.

This how to install or reinstall Virtual Box Guest Additions on Fedora 14.

First we need the kernel headers:

> yum install -y kernel-devel
> yum -y update

Then from the virtual machine menu, select Devices/Install Guest Additions and mount the image by selecting it from Fedora “Places” menu. Then run the Additions installer:

> cd /media/VBOXADDITIONS_4.0.0_69151/
> ./

Watch output for errors. That is it. Now you can use mouse on the virtual machine as it is your desktop extension and mount shared directories:

> /sbin/mount.vboxsf mydir /share/vbox/mydir

How to run Java samples from VMware SDK on Ubuntu 10.04

There are subtle differences in all Linux platforms and when I got to run VMware SDK Java samples on Ubuntu 10.04 I found there is something that is worth to share in addition to my first post about it.

First of all, there are very convenient “default” packages for JRE and JDK that have openjdk-6-jre and openjdk-6-jdk:

apt-get install default-jre defalt-jdk

Of course that means a different value for JAVAHOME:

export JAVAHOME=/usr/bin/openjdk-6/

Second, in my first post I did not describe how to get and store VMware server certificates.

If you follow the Setup Guild then you have to connect to a VMware server by SSH or use the vClient. But you can get the certificate from the Firefox browser: when connecting to a VMware server and asked to confirm the certificate, there is a button to export it. This allows to save the certificate locally and then add it to the keystore:

keytool -import -file XXX.XX.XX.XX.XX.cer -alias XXX.XX.XX.XX.XX \
-keystore vmware.keystore VMKEYSTORE=~/vmware-certs/vmware.keystore

Also the tofrodos package has different name for the dos2unix utility, it is called fromdos now:

apt-get install tofrodos
cd %SDKHOME%\samples\Axis\java
fromdos *.sh

Unfortunately the axis binaries I still had to download manually.

HowTo: Install New ALSA Driver

During initial installation of Ubuntu 10.04 it detected my audio chip (integrated with my Gigabyte motherboard) without any problems, but after a couple of hibernations or for some other reason it lost it:

aplay -l
no soundcard found

I actually was surprised it found it at the first place as on any platform this kind of audio requires installation of hi-def drivers.

Anyway, first I tried to reload ALSA:

sudo alsa force-reload

It did not help.

Then after some digging I decided to compile and install the ALSA driver for my codec. My codec happened to be Realtek ALC888:

cat /proc/asound/card*/codec#* | grep Codec
Codec: Realtek ALC888

I got the driver from the Realtek web site.

Then untared, compiled and installed it:

tar xf LinuxPkg_5.15rc5.tar.bz2
cd realtek-linux-audiopack-5.15/
tar xf alsa-driver-1.0.23-5.15rc5.tar.bz2
cd alsa-driver-1.0.23/
./configure --with-cards=hda-intel
sudo make install

After rebooting got Rhythmbox loaded with Dire Straits and Tracy Chapman, sounds amazing.

How to run Java samples from VMware SDK

VMware SDK a.k.a. vSphere Web Services SDK 4.0 comes with Java and C# samples. This is what it took me to get them running on Ubuntu 8.10.

1. Download the SDK from into a separate directory:

> mkdir vi-sdk-4.0.0-161137

2. Install Java and Axis:

> apt-get install sun-java5-bin sun-java5-demo sun-java5-doc \
sun-java5-fonts sun-java5-jdk sun-java5-jre sun-java5-plugin \
> wget
> tar xzf axis-bin-1_4.tar.gz
> ln -s /home/dmitri/projects/vi-sdk-4.0.0-161137/SDK/ visdk

3. Setup environment variables:

export AXISHOME=~/apps/apache/axis/
export JAVAHOME=~/apps/java/jdk1.5.0_19/
export SDKHOME=~/apps/visdk/
export WBEMHOME=${SDKHOME}samples/Axis/java/lib/wbem.jar
export PATH

4. Build the samples following the Setup Guide

> cd %SDKHOME%\samples\Axis\java
> ./

5. Run the samples:

>./ com.vmware.samples.general.SimpleClient --url \
--username admin --password password

6. Pat yourself on the back.

Anti-aliased Fonts in Emacs

How to build Emacs with anti-aliased fonts

Anti-aliased fonts in the X11 UI enabled from Gnu Emacs version 23.1 (with XFT support).

Unfortunately it not a part of most distros yet, but you can build it yourself from a snapshot:
$ cvs -z3 \
 co -r emacs-unicode-2 emacs
$ cd emacs
$ sudo install texinfo libgtk2.0-dev libxpm-dev libungif4-dev
$ ./configure --with-gtk --enable-font-backend --with-xft
$ make bootstrap
$ sudo make install
$ cat > ~./Xresources
Emacs.background: light gray
Emacs.foreground: black
Emacs.pointerColor: dark green
Emacs.cursorColor: dark green
Emacs.bitmapIcon: on
Emacs.font: Bitstream Vera Sans Mono-12
Emacs.geometry: 80x45
Emacs.internalBorder: 0
Emacs.toolBar: 0
Emacs.verticalScrollBars: off
$ sudo apt-get install ttf-bitstream-vera
$ xrdb -merge .Xresources

See more at:

My Firefox Plugins

My list of favorite Firefox plugins.

I have been using Firefox for a while and even though I switch constantly between at least three browsers (Firefox, Google Chrome and Opera), it is still my favorite thanks to an unmatched set of features and plugins that make browsing much less annoying.

This is my list of favorite Firefox plugins.

First set is the absolute necessity, as without these I cannot surf for more than a few minutes:

    Adblock Plus
    PDF Download

Second is rather optional, but still makes a difference

    Forecastfox Weather
    IE Tab Plus