Friday, November 28, 2008

Vimperator for Opera

mkdir -p ~/.opera/keyboard
cd ~/.opera/keyboard

Copied from the above page:
  • Open up your preferences window and navigate to Advanced->Shortcuts->Keyboard Setup and choose 'vimperopera'. Press O.K.
  • (Optional) To get a more authentic Vim[perator] experience, you may want to hide all of your toolbars except for the tab bar and address bar. Do this from the Tools->Appearance->Toolbars tab, and press Shift+m to toggle the menu bar on/off. I put my address bar at the bottom of the window, and kept the tab bar at the top. I hid all the other toolbars.
  • While in opera, download Standard Slim Skin.

Thursday, November 13, 2008

Vim - my config on CentOS

set vim as a default editor
echo "export EDITOR=/usr/bin/vim" >> /etc/profile
disable flow control in a terminal (unblock ctrl+s, ctrl+q for use in vim)
echo "stty -ixoff -ixon" >> ~/.bashrc

echo '
set mouse=a
set number
set ts=2
set shiftwidth=2
set expandtab
set softtabstop=2
set smartindent
map <c-q> :mksession! ~/.vim/.session <cr>
map <c-s> :source ~/.vim/.session <cr>
nmap <F2> :update <cr>
imap <F2> <C-O>:update <cr>
' >> /etc/vimrc

Without the key mappings above, vim would be too painful for me to use for programming.
Ctrl+q ... save vim's state e.g. what files are opened, cursor position, ...
Ctrl+s ... restore saved state
F2 ... save current file - works in insert mode too

X11 clipboard
yum install vim-X11
echo "alias vim='/usr/bin/vimx'" >> ~/.bashrc
. ~/.bashrc

rails support

Before running, check for latest version and replace 9499 below.
mkdir ~/.vim
cd ~/.vim

enable rails docs
:helptags ~/.vim/doc
then run
:help rails

haml+sass syntax highlighting
Again, check for latest versions and modify 8461 and 7447 below.
mkdir ~/.vim/syntax
cd ~/.vim/syntax
echo '
au! BufRead,BufNewFile *.haml setfiletype haml
au! BufRead,BufNewFile *.sass setfiletype sass
' >> ~/.vim/filetype.vim

problem with haml.vim - carriage returns errors
vim ~/.vim/syntax/haml.vim
and save with
:w ++ff=unix

Swap Escape and Caps Lock keys (to love vim more)
echo '
remove Lock = Caps_Lock
keysym Escape = Caps_Lock
keysym Caps_Lock = Escape
add Lock = Caps_Lock
'> ~/.Xmodmap

File ~/.Xmodmap is processed by /etc/X11/xinit/xinitrc-common when X starts.
To take effect immediately, do
'xmodmap ~/.Xmodmap'

Same on Windoze
save the next 3 lines in a file, e.g. swapEscCL.reg and execute
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,01,00,3a,00,3a,00,01,00,00,00,00,00

:%s/^/ / ... indent all lines
:.,.+3s/^/ / ... indent 4 lines from cusor down
<c-v>2><esc> ... indent 2x on a selected range

vim as development environment

to do
fix problem with javascript highlighting
now have to do
perhaps filetype is not correctly set for js

CentOS 5 root bash prompt

Default root prompt doesn't show host and current folder, because root doesn't have ~/.bashrc file, that loads /etc/bashrc. To fix it, simply copy .bashrc from other user's home dir or, if you don't need to include /etc/bashrc, create the .bashrc file with
echo 'PS1="[\u@\h \W]\\$ "' > /root/.bashrc
which can also go to %post in kickstart.

To load the change without relogin, run
. ~/.bashrc
(don't miss the dot at the beginning)

Blogger setup

Blogger content width in the classic template
I found the default width too narrow. Made it wider in Settings, Layout, Edit HTML with the following replacements:

width: 660px; => width: 1000px
width: 410px; => width: 780;
max-width:700px; => max-width:1000px;

Google Analytics
Once editing the template, why not to add Google Analytic code.
Not using Google Analytic yet? Sign up here.
"It's easy -- and free!"

Sign up for
Google Webmaster Tools and add your blogspot url as a new site. Then go to Sitemaps, Add Sitemap, select Add General Web Sitemap and type atom.xml in step 3 (ignore steps 1 and 2).

Good place to check is Google Webmaster Central and one more about blog feeds and yet nother one about using custom domain.

Wednesday, November 12, 2008

CentOS 5.2 - my desktop configuration

Normally I use Fedora for desktop, but this time I tried something a bit different

Started with kickstart that I previously put together to install headless server and then I installed gnome and the rest.

yum groupinstall 'X Window System' 'GNOME Desktop Environment'
# if get error:" 0002483: nautilus-sendto requires a non-existent" do
rpm -Uvh --nodeps nautilus-sendto-0.7-5.fc6.i386.rpm

It was a nightmare
to set up the correct resolution. First I was trying to find correct setting for my monitor on internet and manually edit xorg.conf, but had no luck. Then I was just fiddling with System/Preferences/Screen Resolution and System/Administration/System and the follwing commands till I got it right, but can't say what made it work.

system-config-display --reconfig
Xorg -configure

The resulting config looks like this:

cat /etc/X11/xorg.conf
# Xorg configuration created by system-config-display

Section "ServerLayout"
Identifier "single head configuration"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"

Section "InputDevice"
Identifier "Keyboard0"
Driver "kbd"
Option "XkbModel" "pc105"
Option "XkbLayout" "us"

Section "Monitor"
Identifier "Monitor0"
ModelName "LCD Panel 1680x1050"
HorizSync 31.5 - 65.5
VertRefresh 56.0 - 65.0
Option "dpms"

Section "Device"
Identifier "Videocard0"
Driver "nv"

Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
SubSection "Display"
Viewport 0 0
Depth 24

Now, when looking at the first line of the file above, it seems that
system-config-display --reconfig
made it work.

USB Mouse & Keyboard
This was another issue that gave me hard time, but this time it was of my own making. I forgot that I purposely disabled USB support in kickstart with this line:
bootloader --location=mbr --append="nousb enforcing=0"

Worked that out from startup log:

dmesg | grep usb
#got message: "usbcore: USB support disabled"

vim /boot/grub/grub.conf
# and remove nousb to get USB working

Install DAG repo from
yum install pgadmin3

Firefox Flash plugin
download yum repo rpm from and then run
yum install flash-plugin

Firefox Java plugin
cd /usr/lib/mozilla/plugins
ls -s /usr/java/jre1.6.0_10/plugin/i386/ns7/
# java location might differ, see what's in /usr/java folder

gnome-do and deskbar-applet
They look fancy, but in the end, alt+F2 might be good enough for me.

gnome-do : activate with Win+space

deskbar applet : activate with alt+F3

Finally, xterm's gray background makes me sad.
echo 'XTerm*background: white' >> /etc/X11/Xresources