Sunday, August 19, 2007

CD/DVD eject - disable lock


#sudo echo "dev.cdrom.lock=0" >> /etc/sysctl.conf

Saturday, May 26, 2007

kqemu - backport from 'feisty' to 'dapper'


Edit apt sources:

#sudo vi /etc/apt/sources.list

--8<--
## Ubuntu source packages for backporting to older releases
deb-src http://mirrors.easynews.com/linux/ubuntu feisty main restricted universe
-->8--


Update, build dependencies and install:

#sudo aptitude update
#sudo apt-get build-dep kqemu
#sudo apt-get source --build kqemu
#sudo dpkg -i *.deb
#sudo module-assistant prepare kqemu
#sudo module-assistant auto-install kqemu


Edit udev rules:

#sudo vi /etc/udev/rules.d/60-kqemu.rules

--8<--
KERNEL=="kqemu", NAME="%k", MODE="0660", GROUP="kqemu"
-->8--


Edit 'kqemu' modprobe.d options:

#sudo vi /etc/modprobe.d/kqemu

--8<--
options kqemu major=0
-->8--


Add user and group:

#sudo addgroup --system kqemu
#sudo adduser your_username kqemu


Load 'kqemu' kernel module:

#sudo modprobe kqemu

Monday, May 21, 2007

qemu


Create a virtual HDD:

#qemu-img create hda.img 5G


Set 512MB of virtual memory, allow access to a virtual HDD and boot from a virtual CD using an ISO file:

#qemu -m 512 -hda hda.img -cdrom ubuntu-7.04-desktop-i386.iso -boot d

-boot a, c, d = floppy drive, hard drive, optical drive respectively
-no-kqemu = if kqemu kernel module not present


Boot from a virtual HDD:

#qemu -m 512 -hda hda.img


Convert a "RAW" HDD image to a "QCOW" compressed image:

#qemu-img convert -c hda.img -O qcow harddiskimage.img


Check image type:

#qemu-img info hda.img

image: hda.img
file format: raw
virtual size: 5.0G (5368709120 bytes)
disk size: 2.3G



#qemu-img info harddiskimage.img

image: harddiskimage.img
file format: qcow
virtual size: 5.0G (5368709120 bytes)
disk size: 891M



CTRL+ALT+2 = qemu console

Save virtual memory state:

(qemu) savevm dump.img

Load virtual memory state:

(qemu) loadvm dump.img


CTRL+ALT+1 = qemu main screen

Start qemu using a hard drive image and restore saved memory state:

#qemu -m 512 -hda hda.img -loadvm dump.img

Monday, April 30, 2007

PDF electronic signature


Required tools:
  • imagemagick
  • pdftk

1. Split multi-page PDF into single pages.

#pdftk offer.pdf burst
#ls
pg_0001.pdf pg_0002.pdf pg_0003.pdf pg_0004.pdf


2. Convert the signature page to an image.

#convert -density 200 pg_0004.pdf pg_0004.png

Experiment with -density to get the best quality.


3. Sign a blank sheet of paper. Take a picture with a digicam. Edit the document image with your favourite image manipulation application (I used KolourPaint) and add your signature.


4. Convert the image back to PDF.

#convert pg_0004.png pg_0004_sig.pdf


5. Merge all pages into a single document.

#pdftk pg_0001.pdf pg_0002.pdf pg_0003.pdf pg_0004_sig.pdf cat output offer_sig.pdf

Monday, April 23, 2007

DPI - change from 75 to 96


There is no one standard DPI. It is actually determined based on monitor size values from DDC given the screen resolution. If DDC does not specify the size, 75 DPI is used by default.

Unlike GNOME, KDE does not force DPI anywhere in its settings. So, when you run KDE and GNOME applications side by side, the font sizes will differ.

When I switch from "nvidia" to the binary "nv" driver, it always sets 75 DPI for my BenQ FP731. To force 96 DPI which will produce consistent font sizes for GNOME, KDE, XFCE and all other applications, I need to edit the display manager's configuration.

Here is how to do it in Xubuntu:

#sudo vi /etc/X11/gdm/gdm-cdd.conf

--8<--
# Definition of the standard X server.
[server-Standard]
name=Standard server
command=/usr/bin/X -br -audit 0 -dpi 96
-->8--


To do it the really easy way using the GDM setup GUI tool:

#sudo gdmsetup

Add the DPI setting in Security > Configure X Server > Command.


The same for KDE greeter:

#sudo vi /etc/kde3/kdm/kdmrc

--8<--
[X-:*-Core]
AllowNullPasswd=true
AllowShutdown=All
NoPassEnable=false
NoPassUsers=
ServerArgsLocal=-nolisten tcp -dpi 96
ServerCmd=/usr/X11R6/bin/X -br
-->8--

nVIDIA binary driver freq fix (Feisty)


When some people switch to the nVIDIA binary driver ("nvidia" as opposed to "nv"), they can no longer access their desktop. For example, my old BenQ FP731 LCD goes black&blank and displays "Out of range".

Here is the fix:

#vi /etc/X11/xorg.conf

Section "Device"
Identifier "nVidia Corporation NV34 [GeForce FX 5200]"
Driver "nvidia"
Busid "PCI:1:0:0"
Option "AddARGBVisuals" "True"
Option "AddARGBGLXVisuals" "True"
Option "NoLogo" "True"
Option "UseEdid" "False"
#Option "UseEdidDpi" "False"
#Option "DPI" "96 x 96"
EndSection

The "UseEdidDpi" and "DPI" options can be used to set the DPI to 96. These settings are specific to nVIDIA gfx chips but there is another way to set a sane DPI...

Friday, April 06, 2007

Airlink101 AWLL3026 wireless USB adapter


Created Ubuntu wiki instead of posting here.

Sunday, March 04, 2007

Aliases: ls, cp, mv, rm, less


# vi ~/.bashrc

alias ll='ls -l'
alias la='ls -A'

# F=classify (append file type indicators), p=append directory indicator,
# s=print file sizes, h=sizes human readable, C=list by columns,
# 1=list in single column, X=sort by extension, S=sort by size,
# t=sort by modification time, u=sort by access time, r=reverse sort
#alias l='ls -psh1X'
alias l='ls -FshC'

alias cp='cp -iv'
alias mv='mv -iv'
alias rm='rm -iv'

# don't overwrite files when redirecting output
set -o noclobber

# g=highlight search, I=ignore case, M=long prompt,
# S=chop long lines (don't fold/wrap), Q=quiet (no bell),
# w=highlight first unread line after scroll, ~=don't show tilde at EOF,
# #n=shift n step(s) when scrolling horizontally
alias less='less -gIMSQW~#2'