Sunday, February 6, 2011

Install Windows 7 on KVM

Method 1 (ref)
qemu-img create -f qcow2 vdisk.img 100g
sudo kvm -m 750 -cd-rom /dev/sr0 -boot d -vdisk.img
    * kvm - calls the kernel virtual machine (obvious)
    * -m 750 - allocates 750mb of memory for the virtual machine
    * -cd-rom sets up the cd-rom. For a physical disk use same disk as your HostOS. For a image, provide a path to the image file.
    * -boot d boots the virtual machine from the cd-rom
kvm -m 512 vdisk.img

Method 2 (link)


Latex Tips

install addon:
make directory 'mypkgs' in /ur/share/texmf/tex/ or /usr/share/texmf/latex
copy the .sty file into mypkgs
run 'texhash'

drawing addons: 1. pgf/tikz, 2. pstricks, 3. Animate

pdf -> eps: pdftops -eps input
crop eps: epstool --copy -b input output
eps -> pdf: epstopdf input --outfile=output

compiling python: pdflatex -escape-shell input

Bangla Linux and Latex

* install bangla fonts
apt-get install ttf-bengali-fonts

Misc. Linux Tips

1. use Cygwin-X in windows, run X-server, connect to linux desktop ssh -Y, run nautilus ... works great :)
2. socks proxy
windows:
    use putty: create a session to remote ssh server, goto tunnel, add a port, select dynamic
    in firefox, set the proxy to manual: localhost at the selected port

    in Linux, create an ssh connection using ssh -D .... and use that port as a SOCKS proxy.


VIM tips

* spelling
:setlocal spell spelllang=en_us / :set nospell
]s move to next misspelled word, [s move to prev. misspelled word
z= suggests correctly spelled words under cursor,
1z= takes the first word from the suggestion list
^Xs does the same in insert mode.
:spellr repeats replacements done with z= for all matches

For more info about spellchecking in vim ->:h spell


* save all open buffers (and quit)
:wa " write (save) any changed files and keep working
:xa " write any changed files and exit

* double click open into vim in a terminal
/usr/bin/gnome-terminal -x /usr/bin/vim

* default tabstop in vim (in vimrc file)
set tabstop=4 softtabstop=4 shiftwidth=4 noexpandtab

* install plugin (in vimrc file)
filetype plugin on
source /usr/share/vim/addons/plugin/(plugin).vim
...
my file:
source /usr/share/vim/addons/plugin/cscope_macros.vim
source /usr/share/vim/addons/plugin/taglist.vim
source /usr/share/vim/addons/plugin/NERD_tree.vim
source /usr/share/vim/addons/plugin/exec_menuitem.vim
source /usr/share/vim/addons/plugin/fs_menu.vim
...

* global copy paste: "+y --> "+p (in vim) / ctrl-v (across any application)
* view filename: ctrl-g
* CScope: do a 'cscope -R -b' in the directory, then run vim to use cscope.out auto.
* CTags: do 'ctags --recurse=yes .' in the directory, run vim, use ctrl-] and ctrl-t
(install cscope and ctags before usage)

Nautilus Terminal

apt-get install nautilus-open-terminal
nautilus -q && nautilus & exit

Upgrading Linux Kernel in Ubuntu

apt-cache search linux-image
apt-get install linux-image-x.x.x-xx