LaTex

  1. My LaTeX templates:
    • Paper (one-column) template: TeX, TXT
    • Paper (two-column) template: TeX, TXT
    • Homework LaTeX template: TeX, PDF, TXT
    • Memo LaTeX template: TeX, PDF, TXT
    • Funding Proposal (generic) LaTeX template: TeX, PDF, TXT
    • headers LaTeX template: TeX, TXT
    • Notes/Annotations LaTeX template: TeX, TXT

  2. Links: LaTeX Math Symbols
  3. pdftk to merge extract pages from PDF files
  4. My Calendar templates: Blank Weekly ODF, PDF.

Unix

  1. Find files of zero size: find dirname -type f -size 0 -exec rm {} \;
  2. List only directories: ls -l | grep '^d'
  3. Sum file sizes: ls -ls * | awk '{sum = sum + $6} END {print sum}'
  4. Mount/unmount a .ISO image: sudo mount test.iso path-to-dir -t iso9660 -o loop; sudo umount path-to-dir
  5. Remove Blank lines from a text file (and store the result to new file): grep “[!-~]” file1 > file2
  6. Tar and copy files: tar cf - * | ( cd /target; tar xfp -)
  7. Tar and encrypt: tar -cj directory | openssl des3 -salt > encrypted.tarfile
  8. Tar and decrypt: cat encrypted.tarfile | openssl des3 -d -salt |tar -xvj
  9. Rename files (ex. from .htm to .html): for file in *.htm ; do mv $file `echo $file | sed 's/\(.*\.\)htm/\1html/'` ; done
  10. Reduce size of PDF files: gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=outputfile.pdf inputfile.pdf
  11. X via sudo: Login with -X. xauth list; sudo su; xauth add 'result from xauth list'; To clear xauth list: xauth list | cut -f1 -d\ | xargs -i xauth remove {}
  12. Add TTF fonts to Oo3:/usr/share/fonts/truetype/

mySQL

  1. Find duplicates in a field: SELECT field, COUNT(*) c FROM table GROUP BY field HAVING c > 1;

Video/Audio Processing

  1. FLV to DVD
  2. - cat f1.flv f2.flv fn.flv > all.flv
    - flv2dvd all.flv
  3. Rotate .MOV files by 90-degrees (converts to .AVI)
  4. - ffmpeg -i input.mov -g 60 -vcodec msmpeg4v2 -acodec pcm_u8 output.avi
    - mencoder -vf rotate=1 -o output.avi -oac lavc -fafmttag 1 -ovc lavc -lavcopts vcodec=mjpeg input.avi
  5. How to concatanate PDF files (method 1)
  6. - gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf x1.pdf x2.pdf x10.pdf
  7. How to concatanate PDF files (method 2)
  8. - pdftk 'input files'cat output
  9. How to concatanate JPG files into a single PDF (method 1; requires imagemagick)
  10. - convert *.jpg -adjoin output.pdf
  11. How to concatanate JPG files into a single PDF (method 2; requires imagemagick)
  12. - convert -compress Zip *.jpg output.pdf
  13. MP4 to MP3
  14. - ffmpeg -i video.mp4 -vn -acodec libmp3lame -ac 2 -ab 160k -ar 48000 audio.mp3 - If not there: sudo apt-get install libavcodec-extra-53

Misc

  1. Ubuntu 11.04 mounting iPhone filesystem
  2. - sudo add-apt-repository ppa:pmcenery/ppa
    - sudo apt-get update
    - sudo apt-get install ifuse libimobiledevice2 libimobiledevice-dev python-imobiledevice