Random Wisdom

Saving power with Linux

by on Dec.03, 2007, under Linux

An interesting site with numerous tips and tricks on power efficient computing using Linux:

LessWatts

It is also home to the rather useful “PowerTOP” tool. If the testimonials are anything to go by, everyone running a recent release of Linux should give this a try.

Leave a Comment :, more...

Embedded multimedia in LateX/Prosper

by on Dec.01, 2007, under How To ..., LaTeX

The movie15 package by Alexander Grahn is useful for this purpose. The movies embedded, however, cannot be viewed with any PDF reader on Linux.

Leave a Comment :, , more...

Extracting Audio/Video

by on Dec.01, 2007, under How To ..., Linux, Software

It’s really easy to extract either audio or video from a multimedia file using ‘ffmpeg‘. To extract audio only:


$ ffmpeg -i inputfile -vn -acodec copy outputfile

And for video only, replace ‘-vn‘ with ‘-an‘ and ‘-acodec‘ with ‘-vcodec‘.

ffmpeg is also commonly used as a transcoding tool.

Leave a Comment :, , more...

SSH Blacklisting

by on Nov.29, 2007, under How To ..., Linux, Software

After getting around 1500 failed ssh login attempts a day for a while on a server I manage, I decided to look into tools that automatically blacklist offending IPs.

Sshblack fits the bill perfectly. A HOWTO (including an init-script) for REDHAT-like systems is available from the OSS Watch Wiki.

1 Comment :, , , more...


Duplicate identifiers with hyperref in pdflatex

by on Oct.01, 2007, under LaTeX

The following warning is fairly common when hyperref is used with PDFLaTeX:

! pdfTeX warning (ext4): destination with the same identifier (name{page.1}) ha
s been already used, duplicate ignored

The solution is to use the ‘plainpages=false‘ option with hyperref.

However, this appears to be insufficient for the article class with the ‘titlepage‘ option. To remedy the warning the following is additionally needed around the \maketitle in the body of the document:


\renewcommand{\thepage}{\roman{page}}
\maketitle
\renewcommand{\thepage}{\arabic{page}}

By switching the style of page counter before and after the title page, any ambiguity regarding page numbers is resolved (title page is logically page 1 but LaTex re-initiates the counter on the actual page 1 – leading to 2 successive page 1s).

Leave a Comment :, , more...

User installation of additional TeX/LaTeX classes and styles

by on Aug.09, 2007, under How To ..., LaTeX, Linux

When you are the sysadmin, you can simply drop the new class/style files under the system TeX path (e.g. /usr/share/texmf/tex/) and run ‘texhash’ to have them automatically picked up. But what do you do when you are just a regular user?

TeX/LaTeX looks at the TEXINPUTS environment variable to look for additional locations to search for included/referenced files. Therefore, new classes/styles can be easily added as follows:

  1. Create a directory for the files:
    $ mkdir -p $HOME/tex/latex
  2. Place the new class files into that folder (each class can be in its own directory and contain subdirectories):
    $ cp -a fancy-class $HOME/tex/latex/
  3. Export the TEXINPUTS variable and also add it to your $HOME/.bash_profile:
    $ export TEXINPUTS=.:$HOME/tex/latex//:$TEXINPUTS

The ‘.’ ensures that the working directory is included in the search path. The double-‘//’ tells bash to also include files in subdirectories of ‘$HOME/tex’ recursively.

New BibTeX files can also be added locally in a similar fashion. The variables to set are then BSTINPUTS and BIBINPUTS.

The environment variable to set for MakeIndex styles is: INDEXSTYLE.

Source: AstroNat – Installation at The Smithsonian/NASA Astrophysics Data System

UPDATE [16 July 2009] The Kpathsea manual provides a wealth of information about usable environment variables.

1 Comment :, , more...

Network Security

by on Aug.09, 2007, under How To ..., Linux, Software

Leave a Comment : more...

Joining PDF Documents

by on Aug.03, 2007, under How To ..., Linux, Software

A quick search on the web reveals that the simplest (and most available) command to do so is:


$ gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf

Source: Putting together PDF files by Scott Nesbitt on NewsForge

[Update: Feb 1, 2011] jpdftweak is probably a better option with many useful features.

Leave a Comment :, , more...

Named Pipes (FIFOs)

by on May.22, 2007, under How To ..., Linux

A named pipe is a special kind of file on *nix systems that can be used for inter-process communication. They behave like FIFOs and are created using the command “mkfifo“:


$ mkfifo mypipe
$ ls -l mypipe
prw-rw-r-- 1 xxx xxx 0 May 22 10:18 mypipe

The “p” in the attributes list indicates that this is indeed a pipe.

A trivial example of its use may be to redirect the output of a command on a remote server to a pipe and then reading from that pipe from another host via ssh.

Leave a Comment :, more...