2011-09-26

git user configuration override

In case if it's required to have a different user configuration from the one stored in .gitconfig, there is two possible ways to achieve this:

Local (per git)
$ cd git-repo
$ git config user.name "Name Surname"
$ git config user.email "name.surname@domain.com"
Global

This method will override default or git's user configuration. Add following to .bashrc:
function gitswitch () {
    case "$1" in
    "custom")
        export GIT_AUTHOR_EMAIL="name.surname@domain.com"
        export GIT_AUTHOR_NAME="Name Surname"
        export GIT_COMMITTER_EMAIL="name.surname@domain.com"
        export GIT_COMMITTER_NAME="Name Surname"
        echo "Using custom configuration."
        ;;
    "default")
        unset GIT_AUTHOR_EMAIL
        unset GIT_AUTHOR_NAME
        unset GIT_COMMITTER_EMAIL
        unset GIT_COMMITTER_NAME
        echo "Using default configuration from .gitconfig."
        ;;
    *)
        echo "Bad argument - please specify 'custom' or 'default'."
        ;;
    esac
}
And then:
$ gitswitch custom
Using custom configuration.
$ gitswitch default
Using default configuration from .gitconfig.
$ gitswitch ?
Bad argument - please specify 'custom' or 'default'.

2011-08-29

To Go or not to Go?

Apparently Go language makes more and more community attention. Today made a 15 min try and was surprised how simple and fast you can get into it.
Surprisingly, there is bindings for GTK which allows to write GUI apps for both Linux and Windows, and one of the demos looks as simple as:
package main

import (
	"os"
	"github.com/mattn/go-gtk/gtk"
	"fmt"
)

func main() {
	gtk.Init(&os.Args)
	window := gtk.Window(gtk.GTK_WINDOW_TOPLEVEL)
	window.SetTitle("GTK Table")
	window.Connect("destroy", gtk.MainQuit)

	swin := gtk.ScrolledWindow(nil, nil)
	swin.SetPolicy(gtk.GTK_POLICY_AUTOMATIC, gtk.GTK_POLICY_AUTOMATIC)

	table := gtk.Table(5, 5, false)
	for y := uint(0); y < 5; y++ {
		for x := uint(0); x < 5; x++ {
			table.Attach(gtk.ButtonWithLabel(fmt.Sprintf("%02d:%02d", x, y)),
						 x, x+1, y, y+1, gtk.GTK_FILL, gtk.GTK_FILL, 5, 5)
		}
	}
	swin.AddWithViewPort(table)

	window.Add(swin)
	window.SetDefaultSize(200, 200)
	window.ShowAll()

	gtk.Main()
}

2011-07-29

First post, again

Finally decided to move my blog to blogspot. Hello World.

2010-03-09

OpenPGP key generation for GnuTLS

Create key pair. Write down the key number.
gpg --gen-key
Edit the key with the command below.
gpg --edit-key 1F8D4A4C
In gpg prompt enter passwd and specify empty password, type quit.
gpg --armor --export 1F8D4A4C> public.key
gpg --armor --export-secret-keys 1F8D4A4C> secret.key
Delete keys from keyrings if required.
gpg --delete-secret-keys 1F8D4A4C
gpg --delete-keys 1F8D4A4C

2009-12-04

Subversion repository part migration

svnadmin dump /srv/svn/old-repo | svndumpfilter include --drop-empty-revs --renumber-revs /directory-name > directory.svndump
svnadmin load /srv/svn/new-repo < directory.svndump
Please note, that if directory structure needs to be changed (for example, from /old-repo/projects/dir to /new-repo/dir) manual edit of dump file will not help. Instead, sed must be combined with svndumpfilter. Additional info regarding this topic can be found here.

2009-12-03

Virtualbox 3.1.x Linux guest dead keyboard fix

After new release of Virtualbox was installed and my virtual machine with OpenSUSE on-board had started, I've ended up with a dead keyboard. It worked fine on Windows XP as host, but OpenSUSE VM was acting like there is no keyboard at all. Couple of minutes of brain activity and finger work I've found that /etc/X11/xorg.conf was replaced during Virtualbox Guest Additions update. Comparing xorg.conf between two latest VB releases, I was able to get the keyboard working. Here is a fix:

1. Restore old xorg.conf :
cp /etc/X11/xorg.conf.bak /etc/X11/xorg.conf
2. Add Option "CoreKeyboard" to InputDevice section of Keyboard[0]
3. Add Option "CorePointer" to InputDevice section of Mouse[1]
4. Add Option "SendCoreEvents" to InputDevice section of Mouse[2]
5. Rename Device option from InputDevice section of Mouse[2] from /dev/vboxadd to /dev/vboxguest

2009-09-17

How to change language in GIMP on Windows

After installing GIMP on my laptop I've found it's language is set according to my regional settings. However, I have failed trying to change it to english because there is no visible configuration option for that. Now that's weird!
After googling for few minutes I've found that this is not a GIMP problem but rather GTK+ for Windows and to force it to use english translation by default you need to add lang environment variable with the value of c.

2009-09-14

Removing MinGW dll dependencies

libgcc_s_dw2-1.dll

Passing -static-libgcc will remove this dependency for all languages other than C.
Note: C++ exceptions depends on this option.

mingwm10.dll

Remove -mthreads option from your makefile.
Note: Multithreading and C++ exceptions depends on this option.