Home page

Research

Publications

Teaching

Public Resources

Public Profiles

Giampiero Salvi :: Resources

Links

My friend Lisa's beautiful drawings
The Wirströms list
My blog at Blogspot

Downloads

Useful one-liners

This is a collection of useful one-liners that come handy when you don't have time to read the program's man pages. I did this mostly for myself, see if you find it useful. All the tools described here are freely available on unix systems (on Ubuntu/Debian apt-gettable).

Images to PDF and viceversa (ImageMagick)

Convert many files and concatenate them into one pdf (works with any other image format supported by ImageMagick):

convert *.jpg file.pdf

PDF concatenation (pdftk)

Simple case: concatenate all pdf files in the current directory into one:

pdftk *.pdf cat output all.pdf

Slightly more complicated: substitute pages 13 and 14 of file1.pdf with the corresponding pages from file2.pdf (can be used also to cocatenate only a subset of pages from each file):

pdftk A=file1.pdf B=file2.pdf cat A1-12 B13-14 A15-16 output file3.pdf

Change file encoding (recode)

Change file encoding from ISO-8859-1 to UTF-8 (Unicode). Note that you can achieve the same in emacs by pressing C-x C-m f utf-8 or C-x RET f utf-8:

recode ISO-8859-1..UTF-8 file

Emacs: Run external command on region (e.g. count words)

Start the selection with C-space, move to the end of the region, press M-x shell-command-on-region (the same with M-| but didn't work for me), then type the command and Enter. For example with 'wc -w' you can count the words in the region. Put this in your .emacs file to add the commands count-words-buffer and count-words-region

Extract images from video (ffmpeg, from here)

ffmpeg -i input.avi images%05d.jpg
ffmpeg -i input.dv -r 25 -f image2 images%05d.png

Capture Webcam (MPlayer, ffmpeg)

mencoder tv:// -tv driver=v4l:width=320:height=240:device=/dev/video0:forceaudio:adevice=/dev/dsp -ovc lavc -oac mp3lame -lameopts cbr:br=64:mode=3 -o webcam.avi

or...

ffmpeg -vd /dev/video0 -ad /dev/audio1 -b 128 -r 15 -s 352x240 -target

Play SpeechDat files with SOX

play -t raw -c 1 -e a-law -r 8000 filename

more to come...