Misc. Tool Tips
LaTeX
- Merge PDF files (*nix)
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite \ -sOutputFile=merged.pdf f1.pdf f2.pdf ...
- Add wide floats (figures, tables, etc.) into latex with \makebox
\begin{figure} \centering \makebox[\textwidth]{% \subfloat[sub title1]{ \label{fig:subfig1} \includegraphics[\width=0.6\textwidth]{subfig1}} \subfloat[sub title2]{ \label{fig:subfig2} \includegraphics[\width=0.6\textwidth]{subfig2}} } \end{figure}
Binutils
- Find files with restrictions
find . -path './.*' -prune -o -perm 700 -type f ! -name \*.py ! -name \*.pyc -print
- -prune is used to exclude some of the path, such as .hg, .svn, etc.
- ! is logical NOT on the following statement.
- The last -print is essential, unless find will print the name of excluded directory (.hg for example). Referred to "Common Gotcha" section of this for more detailed explanation.
- Copy files according to "find" results.
There are several ways to do this:
- Use -exec option of find, but may have performance issue if the
number of resulting files is large.
find . -name "test" -exec cp "{}" /dest/directory \;
- Bridge find and cp with xargs, no potential performance issue.
find . -name "test" -print0 | xargs -0 -I{} cp "{}" /dest/directory
- A little variant to the last approach, only works with GNU cp
find . -name "test" -print0 | xargs -0 cp -t /dest/directory
- Use -exec option of find, but may have performance issue if the
number of resulting files is large.