?

Log in

No account? Create an account
Sep. 22nd, 2008 @ 02:35 pm Shell Recipes
I doubt these will be useful to anyone else reading this, but I'm going to collecting these here as notes to myself so that I don't lose them. I should really just turn them into shell scripts.


Generate an Emacs TAGS file for a project
find . | grep -E "\.(cpp|cc|cxx|hpp|h|hxx)$" | etags -
Use this recursively scan a directory and all subdirectories for C++ source code, and index it with etags.


Convert PDFLaTeX PDF to Illustrator-usable EPS
gs -dNOCACHE -dNOPAUSE -dBATCH -dSAFER -sDEVICE=epswrite -dEPSCrop -sOutputFile=out.eps in.pdf
Use this to turn a page with snippets of equations into vector paths that Adobe Illustrator can handle without choking on font embedding and substitution issues. Good for keeping fonts consistent when labeling charts and diagrams. Also good for embedding equations into diagrams.


Convert B&W scans to searchable PDF
convert pagexxx.png -filter Cubic -resize 200% -threshold 50% -compress Group4 pagexxx.tiff
tiff2pdf -z -p letter -ro -x 1200 -y 1200 -o pagexxx.pdf pagexxx.tiff
Scan pages in, clean them up in an image editor, save to individual files. Use these two commands to convert each page to PDF. Combine in Acrobat Professional, and use the built-in OCR with the "Searchable Image (Exact)" option. Gives excellent image quality and file size (avoids bad JPEG image recompression.)


Grouped bar charts, thick lines, and font embedding with gnuplot
set terminal postscript eps enhanced color solid linewidth 3 \
    "NimbusSanL-Regu,17" fontfile "/opt/local/share/texmf-dist/fonts/type1/urw/helvetic/uhvr8a.pfb"
set output 'cache_issue.eps'
set style data boxes
set boxwidth 0.2
set xlabel "Pirates"
set ylabel "Ninjas"
set grid y
set xrange [0:4]
set yrange [0:6]
set xtics ("1"  0.5, \
           "2"  1.5, \
           "3"  2.5, \
           "4"  3.5 )
plot '-' using ($1-0.7):($2) title "Red" with boxes fs pattern 0, \
     '-' using ($1-0.5):($2) title "Green" with boxes fs pattern 2, \
     '-' using ($1-0.3):($2) title "Blue" with boxes fs pattern 3
1 2.4104
2 4.4581
3 4.7087
4 4.7337
e
1 0.5815
2 1.0963
3 1.1257
4 1.1282
e
1 0.7219
2 1.3632
3 1.4184
4 1.4223
e
Basic example of how to set up grouped bar charts. First line shows how to make lines thicker so that they'll show up better when reduced to the width of a text-column. Also shows how to specify a specific postscript font file to be embedded.
About this Entry
Zen-chan (smoothed)