Author Archive

LaTeX – Customize page numbering

October 4, 2006

For changing the default, centered page numbering, use the fancyhdr package:

\fancyhf{} % clear all header and footer fields
\fancyfoot[R]{\footnotesize Page \thepage\ of 2}

This will print the page number on the right side of the footer, smaller font and in the format “Page % of 2”.

Variable reassignment in makefiles

August 5, 2006

To change the value of a variable assigned in makefile, inside a rule, use this:

target ... : variable-assignment

on a separate line by itself.


prog: CC=g++
prog: prog.cpp
	${CC} -o prog prog.cpp

Found here:

Bundle files in Unix

August 5, 2006

Use this script to bundle files that will automagically unbundle when the file is executed:

## Bundle --  put listed files into a bundle on stdout which sh will unbundle
# From "The UNIX Programming Environment," by Brian Kernighan and
#   Rob Pike, Prentice Hall, 1984.
echo "# To unbundle, sh this file"
for i
  echo "echo $i 1>&2"
  echo "cat >$i <<'End of $i'"
  cat $i
  echo "End of $i"

Unix/Linux — find & xargs — Spaces in filenames

July 30, 2006

Spaces in filenames can be a problem when using find | xargs combination.

To solve this, use:

find . -print0 | xargs -0 <command>

This tells find and xargs to use the ASCII NUL character instead of space to end (separate) the filenames.

VIM – Comment blocks of code

July 28, 2006

Mark the area which is to be commented using the *blockwise* visual mode (CTRL-V, in Windows this is CTRL-Q).

Press I (capital i) and write the text you want to prepend to each line of the selected block, e.g. %.

Then press ESC and the text will be inserted to the left of each line of the selected block.

Compile Python eggs

July 28, 2006

To compile a .egg from a standard based Python package, add

from setuptools import setup

to, before the other setup/distutils imports, and then run

./ bdist_egg
This will create a .egg package in dist/ subdirectory, and can be installed with easy_install.

Double spacing in LaTeX

July 26, 2006

Add at the beginning:


Then switch between different spacing options with:


For other sizes use the \setstretch command like this:


Speed up Firefox in Linux

July 20, 2006

The IPV6 in Linux slows down Firefox.

To fix this, open the file browser, go to /etc, right click on “modprobe.conf“, choose “open with” > “gedit” and add the lines

alias net-pf-10 off
alias ipv6 off

to the bottom of the file, then save and exit.

This will significantly increase browsing speed by decreasing DNS lookup time.

Process memory usage

July 20, 2006

pmap – report memory map of a process

Databases/SQL — MySQL — create database

July 20, 2006

How to create a database in MySQL:

# mysql -u root -p
mysql> create database db_name;
mysql> grant all privileges on db_name.* to
db_user@”localhost” identified by ‘db_pass‘;