June 28, 2012

gpg file encryption

To encrypt files using gpg with symmetric cypher (i.e., password based):
gpg -c FILE_TO_ENCRYPT > ENCRYPTED_FILE

To decrypt the above file (output is stdout):
gpg -d ENCRYPTED_FILE

June 27, 2012

hibernation error in Ubuntu

Even though swap seemed to be configured properly, I experienced a hibernation error in Ubuntu:
PM: Not enuogh free memory
PM: Error -12 creating hibernation image

The solution was to execute "echo 0 > /sys/power/image_size", which instructs the OS to make the suspend image as small as possible.

June 26, 2012

exclude updates in yum

In order to prevent certain updates in yum, such as for kernels, you can add a line like this in "/etc/yum.conf":
exclude="kernel*"

By using the command "yum --disableexcludes=all update" it is possible to temporarily disable the excludes.

Note that such excludes will override those in "/etc/sysconfig/yum-autoupdate" (which is used when yum is called automatically from "/etc/cron.daily/yum-autoupdate"). IMPORTANT: This override happens even if commenting out the excludes in "/etc/yum.conf", because detection in "/etc/cron.daily/yum-autoupdate" is done based on simple grep!

June 22, 2012

add launcher to Ubuntu Unity dock

1) Create file "~/.local/share/applications/YOUR_NAME.desktop"

2) Add following entries to the file
[Desktop Entry]
Name=YOUR NAME
Comment=YOUR COMMENT
Exec=/PATH/TO/COMMAND
Icon=/PATH/TO/ICON
Terminal=false
Type=Application
StartupNotify=true

3) Drag the file to the dock (you may need to use Ctrl+H in Nautilus to show hidden files). Alternatively, log out and log in to restart Unity, but I found that this doesn't always work.

add new locale in Ubuntu

1) Check active locale with command "locale -a".

2) Add new locale for Japanese: in file "/var/lib/locales/supported.d/ja" add line "ja_JP.EUC-JP EUC-JP".

3) Regenerate locale information with command "sudo dpkg-reconfigure locales".