James J. Leifer / recipes


Warning: Not updated often and often false. Use at your own risk.

Also: some /usr/local recipes I cooked up when using debian for the first time: usr-local.txt.

So that I shouldn't forget...

tex

  1. Get the distro as root
    cd /tmp
    mkdir textmp
    cd textmp
    mkdir binaries base doc fonts goodies
    ftp ftp.tex.ac.uk
    ftp> bin
    ftp> prompt
    ftp> mget install.sh base doc fonts goodies binaries/ix86-linux-libc6.tar.gz
    ftp> quit
    chmod +x install.sh
    ./install.sh
    
    Follow all the defaults, except add these options (accepting the default directories) Start the installation. Answer `n' to the question about a separate directory for each architecture.
  2. Execute the following and also add it to ~leifer/.profile
    export TETEX=/usr/local/teTeX
    export PATH=$TETEX/bin:$PATH
    export MANPATH=$TETEX/man:$MANPATH
    export INFOPATH=$TETEX/info:$INFOPATH
    
  3. -------- If working from Mandrake rpms start here -------.
  4. Delete the final control-Z from /usr/local/teTeX/share/texmf/tex/latex/misc/picins.sty
  5. Add the following to the end of /usr/share/texmf/web2c/texmf.cnf:
    main_memory.latex = 1100000
    hash_extra.latex = 25000
    pool_size.latex = 750000
    string_vacancies.latex = 45000
    max_strings.latex = 55000
    pool_free.latex = 47500
    nest_size.latex = 500
    param_size.latex = 1500
    save_size.latex = 5000
    stack_size.latex = 1500
    
    When changing these, it's best to rerun texconfig rehash as shown below.
  6. Configure:
    texconfig mode ljfour &&
    texconfig xdvi a4 &&
    texconfig dvips paper A4size &&
    texconfig dvips printcmd - &&
    texconfig init &&
    texconfig rehash
    
    (The printcmd - disables automatic printing by dvips.)
  7. -------- If working from Mandrake rpms stop here -------.
  8. To uninstall
    rm -rf /usr/local/teTeX
    rm -rf /var/tmp/tex*
    

bibclean: Cleaning a bibtex file

Use bibclean. How to make...

$mkdir ~/pkg/bibclean-2.11.3 ~/pkg/bibclean-2.11.3/bin \
~/pkg/bibclean-2.11.3/man ~/pkg/bibclean-2.11.3/man/man1
$cd /tmp
$tar -zxf ~/pkgsrc/bibclean-2.11.3.tar.gz
$cd bibclean-2.11.3/
$./configure

edit config.h to comment out with /* ... */ the line
    extern int ioctl ARGS((int, int, ...));
$make
$make prefix=~/pkg/bibclean-2.11.3 install

add to .profile
   export PATH=~/pkg/bibclean-2.11.3/bin:$PATH
   export MANPATH=~/pkg/bibclean-2.11.3/man:$MANPATH

bibextract: Extracting entries from a bibtex file

The bibtex file Leifer.bib is generated as follows

bibextract "author" "Leifer" <~/texery/bibs/bib/jjl.bib >~/public_html/articles/Leifer.bib

using Nelson Beebe's bibextract tool. (Replace nawk with gawk to get bibextract to run.)

pstotext: Extracting text from a postscript file

Get: pstotext and build with

make pstotext

to get text versions of all the postscript files in the current directory:

find . -name '*ps' -exec pstotext -output {}.txt {}  \;

shell / bash

echo $?        #to see the last exit code

enscript

Dump the text file foo to foo.ps:

enscript -B -p foo.ps foo

Useful options: no headings (-B); 2 up landscape (-2r); 1 inch margins: (--margins=72:72:72:72); Courier in 10 pt (-f Courier10).

bib2html

How to make:

$cd /tmp
$tar -zxf ~/pkgsrc/bib2html-1.33.tar.gz
$cd bib2html-1.33

Modify the beginning of the Makefile with

BINDIR=/homes/jjl21/pkg/bib2html-1.33/bin
BIBTEXDIR=/homes/jjl21/pkg/bib2html-1.33/bst
CGIDIR=/homes/jjl21/pkg/bib2html-1.33/bin

Change /local/bin/perl to /usr/bin/perl in bib2html bibsearch gen-bst.

Don't do a `make', just do:

$mkdir ~/pkg/bib2html-1.33
$mkdir ~/pkg/bib2html-1.33/bin
$mkdir ~/pkg/bib2html-1.33/bst
$mkdir ~/pkg/bib2html-1.33/man
$mkdir ~/pkg/bib2html-1.33/man/man1
$make install
$cp bib2html.man ~/pkg/bib2html-1.33/man/man1/bib2html.1

Add to .profile:

$export PATH=~/pkg/bib2html-1.33/bin:$PATH
$export MANPATH=~/pkg/bib2html-1.33/man:$MANPATH
$export BSTINPUTS=~/pkg/bib2html-1.33/bst:$BSTINPUTS

gnu make

Useful options

-n: don't actually make, just show what would be done
--warn-undefined-variables
-r: no builtin rules
-d: debug

prcs

cd /tmp
tar -zxf prcs-1.2.15.tar.gz
mkdir ~/pkg/prcs-1.2.15
./configure --prefix="~/pkg/prcs-1.2.15"
make 
make install

add to .profile:

export PATH=$HOME/pkg/prcs/bin:$PATH
export MANPATH=$HOME/pkg/prcs/man:$MANPATH
export INFOPATH=$HOME/pkg/prcs/info:$INFOPATH

find

Delete all the ,* files:

find . -type f -name ",*" -exec rm {} \;

List files by size and then reverse sort:

find . -printf "%b\t %p\n" | sort -nr

Find files that are `other/group' writable:

find . -not -type l -and \( -perm +020 -or -perm +002 \)
find . -not -type l -and +og=w
find . -type f -maxdepth 1 -regex '\./[0-9]+' -printf "%P\n"
(-type f:           only files
 -maxdepth 1:       only files in the current directory
 -regex '\./[0-9]+' digits
 -printf "%P\n"     omit leading ./
)

Make them non-writable:

find . -not -type l -and \( -perm +020 -or -perm +002 \) -exec chmod og-w {} \;
find . -not -name "." -print0 | xargs -0 rm -rf
delete all the files in the pwd
find . -not -name "." -print0 | xargs -0 ls -ld
see all the files in the pwd

chmod

The following doesn't work (see find for a better solution): the problem is that .* files are not updated.

Make all files non-writable by other/group (-c to see which files have changed; -R for recursive):

chmod -c -R og-w *

date

date -d "Tue, 9 May 2000 11:43:04 +0100 (BST)" +%s
#convert the date to seconds since the 1970s epoch

date -u
#date in utc

date -s "Fri Oct  4 10:12:59 UTC 2002"
#set the date

procmail and formail

formail -x Date <foo       #extract the date field from foo

munpack

If munpack foo gives the error message

Did not find anything to unpack from foo

try munpack -t foo instead.

nmh install

There is sometimes a problem with locking over NFS which causes anno to hang for a while before failing. This in turn causes repl to hang since repl tries to add the ``Replied'' header to the original message...

First, I always do an inc on the local mail machine, i.e. I create the script im:

rsh beaune inc
mark +inbox -add -sequence unseen
mark +inbox -add -zero -sequence n unseen
mark +inbox -add -zero -sequence l10 last:10
mark +inbox -add -zero -sequence l20 last:20
mark +inbox -add -zero -sequence l30 last:30

Second, I use local ``dot locking'' for most of the nmh commands. To do this...

  1. Install db2-devel-2.4.14-2mdk and db1-devel-1.85-4mdk.
  2. Unzip nmh...
    cd /tmp
    tar -zxf nmh-1.0.4.tar.gz
    cd nmh-1.0.4
    ./configure
    
  3. Edit config.h so that the lines now read:
    #define DOT_LOCKING   1
    /* #define FCNTL_LOCKING 1 */
    /* #define LOCKF_LOCKING 1 */
    /* #define FLOCK_LOCKING 1 */
    
    /*
     * If you have defined DOT_LOCKING, then the default is to
     * place the lock files in the same directory as the file that
     * is to be locked.  Alternately, if you define LOCKDIR, you
     * can specify that all lock files go in a specific directory.
     * Don't define this unless you know you need it.
     */
    #define LOCKDIR "/usr/spool/locks"
    
  4. Build and install
    make
    make install
    mkdir /var/spool/locks
    chmod og+rwx /var/spool/locks/
    chmod og+rx /usr/local/nmh
    chmod og+rx /usr/local/nmh/*
    chmod og+rx /usr/local/nmh/man/*
    

    In order to eliminate the Sender: junk in each email (caused by the above mentioned From: trickery), do the following as root: in /usr/local/nmh/etc/mts.conf make sure that the masquerade line looks like:

    masquerade: draft_from
    

    It's possible to uninstall by

    rm -rf /usr/local/nmh
    
  5. In userspace, add:
    export PATH=/usr/local/nmh/bin:$PATH
    export MANPATH=/usr/local/nmh/man:$MANPATH
    
    The man pages are broken, e.g.: man nmh. It's something to do with /usr/local/nmh/etc/tmac.h but I don't understand it well-enough to fix it.

nmh again under mandrake

The locking problems mentioned above bite... I can't use the rpm. Disregard the following.

The nmh binary rpm seems to work fine. But you need to add From: James Leifer <James.Leifer@inria.fr> to ~/Mail/components, replcomps, forwcomps in order to make Bcc give the right address.

Install:

http://fr2.rpmfind.net/linux/RPM/mandrake/8.0////libgdbm1-1.8.0-14mdk.i586.html
http://fr2.rpmfind.net/linux/RPM/mandrake/8.0////libgdbm1-devel-1.8.0-14mdk.i586.html
... nmh ...

In order to make the man pages work, do the following as root:

cd /usr/share/man
bunzip2 tmac.h.bz2

In order to eliminate the Sender: junk in each email (caused by the above mentioned From: trickery), do the following as root: in /etc/nmh/mts.conf make sure that the masquerade line looks like:

masquerade: draft_from

nmh usage

List of all message senders in current folder:

scan -format "%{from}" | sort

Remove all messages from Foo

rmm `pick -list -from Foo`

Refile all messages from Foo to folder Bar

refile +Bar `pick -list -from Foo`

Danger: the -list is essential: without it, pick will fail if no messages match, causing the outer command to assume one is operating on all messages. This is bad design!

Refile my mailing lists (who needs procmail! [grin]):

SOURCE_FOLDER=inbox
for LIST_SUBJECT in 'Caml-list' 'unison-users'; do
  echo ==========================   $LIST_SUBJECT
  echo      pick +$SOURCE_FOLDER last:400 -lbrace -subject $LIST_SUBJECT -and --Precedence bulk -rbrace -list
  MESSAGES=`pick +$SOURCE_FOLDER last:400 -lbrace -subject $LIST_SUBJECT -and --Precedence bulk -rbrace -list`
  scan +$SOURCE_FOLDER $MESSAGES
  echo refile -src +$SOURCE_FOLDER +$LIST_SUBJECT $MESSAGES
       refile -src +$SOURCE_FOLDER +$LIST_SUBJECT $MESSAGES 
done

Sort the messages in folder f by date:

sortm +f -verbose 

mh-profile

The following works... Note that Aliasfile needs the ~ but the Path cannot have it!

draft-folder: drafts
unseen-sequence: unseen
Aliasfile: ~/Mail/aliases
Path: Mail
Editor: emacs           
lproc: less
moreproc: less

mh-e

Now on version 6, but the rest of the following still holds...

Unpack:

cd ~/pkg
mkdir mh-e
tar -zxf ~/pkgsrc/mh-e/mh-e-5.0.2.tar.Z 

Then add the following to .emacs:

(setq load-path (cons (expand-file-name "~/pkg/mh-e") load-path))
(global-set-key "\C-cr" 'mh-rmail) 

and add the following to .profile:

export INFOPATH=~/pkg/mh-e:$INFOPATH

mh-e MIME

Gleaned from this part of the manual. Insert

#image/jpeg ;name="jjleifer.jpg" [] /home/beaune/moscova1/leifer/public_html/jjleifer.jpg

in the message. Then do C-c C-e (mh-edit-mhn). It removes the ----- line, but this is OK. Revert back to the pre-MIME version with C-c C-m C-u (mh-revert-mhn-edit).

uuencode

uuencode foo.tgz foo.tgz >foo.tgz.uue

mew

  1. cd /tmp
    tar -zxf mew-2.0.tar.gz
    cd mew-2.0
    
  2. In Makefile, change prefix=... to prefix=$(HOME)/pkg/mew.
  3. make
    make info
    make install
    

gnus

Assuming $G.tar.gz is in the current directory (e.g. /tmp).

export G=ognus-0.18 &&
tar -zxf $G.tar.gz &&
( cd $G &&
  ./configure && make &&
  ( cd texi && make pdf ) #doesn't always work
) &&
mv $G $PKG/ &&
( cd $PKG &&
ln -nfs $G gnus )

In .emacs, add

;; gnus
(setq load-path (cons (expand-file-name "~/pkg/gnus/lisp") load-path))
;; end of gnus 

In .profile, add

#gnus
export INFOPATH=$PKG/gnus/texi:$INFOPATH
#end of gnus

Also add an info dir item a la ocaml.

artist.el

cd /tmp
tar -zxf artist-1.2.4
cd artist-1.2.4
./cofigure
make
mkdir ~/pkg/artist-1.2.4
cp artist.* ~/pkg/artist-1.2.4
cd ~/pkg
rm artist
ln -s artist-1.2.4 artist

bbdb

cd ~/pkg &&
tar -zxf /tmp/bbdb-2.34 &&
ln -s bbdb-2.34 bbdb &&
cd bbdb-2.34 &&
./configure --with-gnus-dir=../pkg/gnus &&
make gnus info

Add to ~/.emacs.el:

;; bbdb
(setq load-path (cons (expand-file-name "~/pkg/bbdb/lisp") load-path))
(require 'bbdb)
(bbdb-initialize)
;; end of bbdb

In .profile, add

#bbdb
export INFOPATH=$PKG/bbdb/texinfo:$INFOPATH
#end of bbdb

safecat

Put $SAFECAT.tar.gz is in the current directory. Modify the first two lines in the following.

(
SAFECAT=safecat-1.8 && 
DEST=$PKG/$SAFECAT-$MACHTYPE &&
if [ -e $SAFECAT ]; then
   echo "error: please delete stale $SAFECAT and rerun";
   exit 1;
fi &&
tar -zxf $SAFECAT.tar.gz && 
cd $SAFECAT && 
echo $DEST >conf-root && 
make && 
make setup check
) 

emacs

How to regexp query replace in multiple files with emacs: go to dired, select the files with m; do Q and enter the search and replace terms; finally, do M-x save-some-buffers.

Generating ps with outline fonts

Not necessarily as safe as generating ps with bitmaps fonts due to encoding vector weirdness...

dvips -P pdf foo.dvi -o foo.ps

If that causes problems with ligatures (especially when using the times package), try adding -G0 after the -P.... Also try -j0. See

autotrace

The home. Seems to work better with

autotrace -align-threshold 0.2 foo.pnm >foo.eps

ncurses

$cd /tmp
$tar -zxf ~/pkgsrc/ncurses-5.0.tar.gz
$cd ncurses-5.0
$./configure --prefix=~/pkg/ncurses-5.0
$make
$make install             # quite slow

lynx

depends on ncurses; following allows local cgi scripts to run...

$cd /tmp
$tar -zxf /homes/jjl21/pkgsrc/lynx-2.8.2.tar.gz
$export CPPFLAGS="-I/homes/jjl21/pkg/ncurses-5.0/include"
$export LIBS="-L/homes/jjl21/pkg/ncurses-5.0/lib"
$cd lynx2.8.2
$./configure --prefix=/homes/jjl21/pkg/lynx-2.8.2 --with-screen=ncurses --enable-prettysrc \
--enable-underlines --enable-default-colors  --enable-cgi-links --enable-source-cache
$make
$make install
$make install-help
$make install-doc

Modify /homes/jjl21/pkg/lynx-2.8.2/lib/lynx.cfg and uncomment:

TRUSTED_LYNXCGI:none

Create a file ~/.lynx.cfg with

INCLUDE:/homes/jjl21/pkg/lynx-2.8.2/lib/lynx.cfg
TRUSTED_LYNXCGI:file://localhost/

Now,

export PATH=/homes/jjl21/pkg/lynx-2.8.2/bin:$PATH
export MANPATH=/homes/jjl21/pkg/lynx-2.8.2/man:$MANPATH
export LYNX_CFG=/homes/jjl21/.lynx.cfg

ispell

Get a list of misspelled words (-l for noninteraction; -t for tex):

ispell -d british -l -t <foo  | sort -u | less

Intead of british, one can put english (american!). Add correct words to ~/.ispell_words

sdiff

sdiff -s -w 180 foo1 foo2 | less
:only show differences; display each file with 90 columns.

wdiff

wdiff -w "DELETE{" -x "}" -y "INSERT{" -z "}" file1 file2
:show word-level deletes and inserts (regardless of paragraph filling)

grep

grep "^%"
:select lines starting with %

htmlvalidator

home

download:

$ ls ~/pkgsrc/htmlvalidator/
lq-sp-1.3.4.3.tar.gz  sgml-lib.tar.gz  validate

unpack:

$ mkdir ~/pkg/htmlvalidator
$ cd  ~/pkg/htmlvalidator
$ cp ~/pkgsrc/htmlvalidator/validate .
$ chmod a+x validate 
$ tar -zxf ~/pkgsrc/htmlvalidator/lq-sp-1.3.4.3.tar.gz
$ tar -zxf ~/pkgsrc/htmlvalidator/sgml-lib.tar.gz 
$ mkdir lq-sp

modify lq-sp-1.3.4.3/Makefile replacing prefix=... by:

prefix=~/pkg/htmlvalidator/lq-sp

then:

$ cd lq-sp-1.3.4.3/
$ make

here i get stuck; the next method (nsgmls) is better...

nsgmls

First install rpms:

sgml-common-0.2-4mdk
psgml-1.2.1-8
sgml-tools-1.0.9-19mdk
openjade-1.3-10mdk

Download http://validator.w3.org/sgml-lib.tar.gz and unpack it:

cd /usr/lib/
tar -zxf /tmp/sgml-lib.tar.gz

There's some slight problem with spurious messages about character encodings. I call the following script checkhtml and invoke it by checkhtml foo.html.

nsgmls -s -c /usr/lib/sgml-lib/catalog $1 2>&1 | \
grep -v "is not a character number in the document character set"

wget

wget -r -np -l0 -nH --cut-dirs=2 -k -K http://www.foo.com/dir1/dir2/dir3/

-r: recursive
-np: don't go up to the parent
-l0: recurse infinitely
-nH: don't generate the directory www.foo.com/
--cut-dirs=2: don't generate dir1/dir2
-k -K: convert absolute links and keep a backup of the converted file

web caching

See the cachability checker. In .htaccess, put:

<Files *>
Header append cache-control "no-cache, must-revalidate, max-age=1"
Header append pragma "no-cache"
</Files>

ocaml with pthreads

Copy these instructions into emacs and then replace PP by /opt and XX by ocaml-3.04, for example.

caml: findlib

http://www.ocaml-programming.de/packages/findlib-0.5.2.tar.gz

cd /tmp
umask u=rwx,g=rx,o=rx
tar -zxf findlib-0.5.2.tar.gz
cd findlib
make all
make opt
su
umask u=rwx,g=rx,o=rx
make install

caml: libpq_ocaml

This sets up postgresql bindings.

http://www.eleves.ens.fr:8080/home/frisch/info/libpq_ocaml-0.3.tar.gz

cd /tmp
umask u=rwx,g=rx,o=rx
tar -zxf libpq_ocaml-0.3.tar.gz
cd libpq_ocaml

modify Makefile by:
  CAML_LIB = /usr/lib/ocaml/caml

DOESN'T WORK: quits with 

libpqstub.c:23: libpq-fe.h: No such file or directory
libpqstub.c:24: libpq/libpq-fs.h: No such file or directory
make: *** [libpqstub.o] Error 1

netscape

Edit ~/.netscape/preferences.js... To remove the shop button, add:

user_pref("browser.chrome.disableMyShopping", true);

and prevent ns from creating ~/nsmail update the following line:

user_pref("mail.directory", "");

recode

Convert latin1 to tex. (-d: only touch accents). Note: it's important to have an output file or else recode will rewrite the original file

recode -d l1..tex <foo-in >foo-out

perl

(See man perlre for regular expressions...) For example, if removecolour contains:

s/\b 0\.0 \s+ 0\.0 \s+ 0\.92 \s+ TeXcolorrgb \b
 /0\.0 0\.0 0\.0 TeXcolorrgb
 /gsx;

then perl -p -0777 removecolour <foo >bar performs the replacement. For a one-liner, do instead

perl -p -0777 -e 's/.../.../...;' <foo >bar

Examples. To see the words in foo:

strings foo | perl -p -0777 -e 's/\b\s*\b/\n/gsx' | sort | uniq | less

To get the email addresses in an INRIA group (e.g. Arles):

hand 31303 | perl -p -0777 -e 's/\n([^\n])/\t\1/gsx' | grep rocq | perl -p -e 's/E-mail\.*: ([^\t]*)\t.*/\1/gmx' | perl -p -0777 -e 's/(\ |\t)//gsx' | sort

Command line options:

-p
treat the input as a perl expression (not a whole program);
-0777
the separator between records is 777 in octal; this is not a real ASCII char so the whole file is slurped in as a single record;

Regexps:

( )
grouping;
|
alternation;
*
zero-or-more (postfix op);
+
one-or-more (postfix op);
[a-z]
range;
[^a]
not literal;
\d
digit;
\b
word boundary;
\s
whitespace;
\n
newline;
\t
tab;
\
space (necessary because unescaped spaces are ignored with the /x option);
$& $1 $2...
whole match, first matched piece, second, etc. (in the replacement text).

mozilla

To make mime work with mozilla 0.9.3, edit directly

~/.mozilla/leifer/po4cptjx.slt/mimeTypes.rdf

vsound

Note:
-f: output file (must be .wav)
-t: adjust timing for streaming audio

Example:
vsound -f /tmp/chom.wav -t ~/RealPlayer9/realplay rtsp://nmis031.mit.edu/tac/chomsky-18oct01-16k.rm

host

Thanks to David Richerby for this.

host -va foo.bar.com
:get information about a host
:-va for verbose + all

renice

Make pid be nicest (least aggressive use of the cpu):

renice 20 -p pid

Make pid be nastiest (most aggressive use of the cpu):

renice -20 -p pid

tee: stream splitting

How to split a stream into several named pipes:

mkfifo /tmp/p1
mkfifo /tmp/p2
cat /tmp/p1 | grep pattern1     # in one window
cat /tmp/p2 | grep pattern2     # in another window
foo | tee /tmp/p1 | tee /tmp/p2 # in a third

ssh

On the client do ssh-keygen (user input shown with ***):

Generating public/private rsa1 key pair.
Enter file in which to save the key (/home/beaune/moscova/leifer/.ssh/identity): ***
Enter passphrase (empty for no passphrase): ***
Enter same passphrase again: ***
Your identification has been saved in /home/beaune/moscova/leifer/.ssh/identity.
Your public key has been saved in /home/beaune/moscova/leifer/.ssh/identity.pub.
The key fingerprint is:

Then copy (or append) ~/.ssh/id_rsa.pub to ~/.ssh/authorized_keys on the server. On the client, keep ~/.ssh/id_rsa and the passphrase secret.

How to set up a secure tunnel from local port 8070 to remote port www-rocq.inria.fr:8080:

ssh -N -e none -f -L 8070:www-rocq.inria.fr:8080 -2 -C beaune.inria.fr

Note

-N : don't make a shell connection
-e none : no escape characters (maybe unnecessary with -N)
-f : go into the background later

remote printing

enscript foo | ssh -l username machinename 'lpr -Pprintername'

netstat

netstat -n -p -l
-n: use numeric ports and ip addresses
-p: show pids
-l: show processes listening to local ports

route

/sbin/route add default gw rocq-gw
:adds a new gateway

iso images

as root:

mkdir /tmp/foo
mount -t iso9660 -o loop /tmp/foo.iso /tmp/foo

then you can treat /tmp/foo as a read-only file system. when done,

umount /tmp/foo

to make an iso image

mkisofs -J -R -o /tmp/cdout.iso path1 path2 ...

options: -J for ``joliet'' (long win file names), -R for ``rockridge'' (unix file names and permissions). it's better, to have a root path and all directories underneath. the root path directory won't be in the iso image.

to burn (on janot):

cdrecord -v -speed=16 dev=0,0,0 foo.iso
cdrecord -v -speed=16 dev=0,0,0 -pad -audio track01.wav track02.wav ...

it doesn't matter if -speed is too high, the system will adapt.

to extract as wav files in the current directory:

cdparanoia -B

IP and DNS configurations

nb: HWaddr is the MAC address

$ /sbin/ifconfig -a
eth0      Link encap:Ethernet  HWaddr 00:A0:C9:EC:F9:A5  
          inet addr:128.232.8.29  Bcast:128.232.15.255  Mask:255.255.240.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:401785 errors:0 dropped:0 overruns:0 frame:0
          TX packets:289897 errors:0 dropped:0 overruns:0 carrier:1
          collisions:21426 txqueuelen:100 
          Interrupt:5 Base address:0x9000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:3924  Metric:1
          RX packets:173102 errors:0 dropped:0 overruns:0 frame:0
          TX packets:173102 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 

$ /sbin/route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
cl-cam-ac-uk    *               255.255.240.0   U     0      0        0 eth0
loopback-net    *               255.0.0.0       U     0      0        0 lo
default         heathrow.cl.cam 0.0.0.0         UG    0      0        0 eth0

$ /sbin/route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
128.232.0.0     0.0.0.0         255.255.240.0   U     0      0        0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         128.232.0.1     0.0.0.0         UG    0      0        0 eth0

$ cat /etc/resolv.conf
domain          cl.cam.ac.uk
nameserver      128.232.1.2     ; resolv1
nameserver      128.232.1.3     ; resolv2
nameserver      128.232.1.1     ; resolv0
search          cl.cam.ac.uk
;END

sendmail

Name translation for outgoing mail (based on these hints in the linux gazette), i.e

leifer@brouilly.inria.fr  --->  James.Leifer@inria.fr

Do the following:

  1. create /etc/mail/genericsdomain:
    brouilly.inria.fr brouilly.inria.fr
    localhost localhost
    
  2. create /etc/mail/genericstable
    leifer James.Leifer@inria.fr
    leifer@brouilly.inria.fr James.Leifer@inria.fr
    leifer@auge.inria.fr James.Leifer@inria.fr
    
  3. add genericsdomain.db genericstable.db to the ``all:'' line in /etc/mail/Makefile and then
    cd /etc/mail
    make
    
  4. backup your sendmail configs
    cd /etc
    cp sendmail.cf sendmail.cf.bak
    cp sendmail.mc sendmail.mc.bak
    
  5. add to the end of /etc/sendmail.mc
    FEATURE(masquerade_envelope) 
    FEATURE(genericstable, `hash -o /etc/mail/genericstable') 
    GENERICS_DOMAIN_FILE(`/etc/mail/genericsdomain') 
    
  6. rebuild the config and restart sendmail
    m4 /etc/sendmail.mc > /etc/sendmail.cf
    /etc/rc.d/init.d/sendmail stop
    /etc/rc.d/init.d/sendmail start
    
  7. finally, do whatever local setup is required.

postfix

[These might be useful too, though I haven't tried them: How to configure postfix on a laptop; how to relay over an ssh tunnel.]

[Should note ssh 2 with postfix config that works for me.]

Add to /etc/postfix/main.cf

relayhost = rocq.inria.fr 
myorigin = $myhost
canonical_maps = hash:/etc/postfix/canonical

Add to /etc/postfix/canonical

leifer James.Leifer@inria.fr

Then:

cd /etc/postfix
postmap canonical
/etc/rc.d/init.d/postfix restart

rpm

Find all packages whose name contains foo:

rpm -qa | grep foo

List packages in installation order.

rpm -q -a --last | less

Show which packages provide a file:

urpmf ndbm.h

show the files installed by a package

rpm -ql foo

gcc-2.95.3

As root:

mkdir /opt/gcc-2.95.3 && \
chown leifer.moscova /opt/gcc-2.95.3 

As user...

cd /tmp && \
tar -zxf gcc-2.95.3.tar.gz && \
mkdir gcc-2.95.3-obj && \
cd gcc-2.95.3-obj && \
../gcc-2.95.3/configure --prefix=/opt/gcc-2.95.3 --enable-cpp > log.configure 2>&1 && \
make bootstrap > log.bootstrap 2>&1 && \
umask 022 && \
make install > log.install 2>&1

As root:

chown -R root.root /opt/gcc-2.95.3 && \
cd /usr/local/ && \
cd bin && \
ln -s /opt/gcc-2.95.3/bin/* . && \
cd ../man/man1 && \
ln -s /opt/gcc-2.95.3/man/man1/* . && \
cd .. && \
cd ../info && \
ln -s /opt/gcc-2.95.3/info/* .

To activate the info pages, follow the instructions for ocaml. Ditto for uninstallation.

network printing under windows 2000 in a unix world

This is highly unscientific, but it seemed to work (at INRIA, circa 2002). Go control panel / printers / add printer. Choose local printer. Choose IP connection. Enter the IP address for ``address'' and the same for ``port''. Choose LaserJet direct for ``interface''. Don't autodetect. Choose a similar printer from the list. Choose not to share this printer.

binhex

Download: macutils-2.0b3-12mdk.i586.rpm

hexbin foo.hqx
macunpack -d foo.bin

This page: http://pauillac.inria.fr/~leifer/recipes.html.

[Validate page.]