Monday, February 28, 2005

Adding fonts : xset

Adding new fonts to your X environment is often problematic.
Following points need to be remembered when adding new fonts in the user path:
- Fonts need be in gzip format so compress them if they aren't.
- Run mkfontdir to generate the fonts.dir file in the new font directory.
- xset +fp sets up the directory in the font search path.
fp rehash rereads the font database given by the current font path.

With these steps we are ready to use the fonts. We can see out current X settings using 'xset q' commnad

Sunday, February 27, 2005

Merge Pdfs

When we need to merge different pdfs or ps files into one, 'gs' interpreter is the best. Merging files is easy just list the files to be concatenated on the command line and the merged file shall be created at the locations provided.

Example:
gs - dNOPAUSE -sDEVICE=pdfwriter -sOUTPUTFILE=Merged.pdf -dBATCH 1.pdf 2.pdf .......(in order we want them to be merged).....

Saturday, February 26, 2005

Htaccess :Restict http access to pages

Htaccess is a method that helps you share your http pages in a rescticted manner, allowing access only after authentication. For example to restrict access some directory in ~/public_html/example_dir create a ".htaccess" file in that directory with lines similar to those given below
--------
AuthType Basic
AuthName RelmName
AuthUserFile path_to_htpasswd_file_here_say_ /extra/.htpasswd
Require user list_of_usr_names_here
------------

This file says that we consult /extra/.htpasswd file to get the usr passwd pair for authentication, where the only user allowed to access are the ones listed in Require field.

The .htpasswd file need be accessible to your http-user ( apache/nobody ) for reading . Good not to have it readable by others.htpasswd utility can be used to set passwds for users ( these need not exist on the system)
Have a look at this link http://httpd.apache.org/docs/howto/auth.html#intro

Multiple slides per page

Often we want to save paper by printing multiple slides of a presentation per page....atleast I want to do it most of the times, saving paper :D. Best way to do this in linux is to use 'psnup' that works with ps files.

Sample usage:
pdf2ps infile.pdf outfile.ps
psnup -l -d -pletter -4up outfile.ps > final.ps

This will make it 4 slides per page, options other than '-4up have to with
'info psnup' shows the huge number of options that psnup takes.

Friday, February 25, 2005

SHLVL

At times we interested in the level of nesting of the shell we are running from ,$SHLVL stores this value .

If we compare its value at a machine's console to that obtained after you ssh to another machine, we can infact get an indirect indication of (non)interactive shells in the initialization scripts...