Friday, July 1, 2011

Vim file type detection: only R for .r and .R

copied from 
http://biostat.mc.vanderbilt.edu/wiki/Main/RVim

Filetype detection

Vim includes syntax highlighting for two other languages that use the .r and .R file extensions. Vim searches up to the first 50 lines of a file and checks the comment syntax to determine whether it is R or Rexx. If no comments are found, it defaults to Rexx. This can be annoying for starting a new script. If you want .r and .R to ALWAYS be associated with R syntax, put au BufNewFile,BufRead .r,.R  setf r in your ~/.vim/filetype.vim (alternatively, you can use the same line in~/.vim/ftdetect/r.vim).

=====

Under ubuntu maverick, I would just change file /usr/share/vim/vim72/filetype.vim 


Thursday, June 30, 2011

obtain a figure file list from a tex file using grep and sed

tmpfile=`mktemp -p . exttmp.XXXX`

grep includegraphics $1 > $tmpfile
sed -e 's/includegraphics/  /' -e 's/[\\{}]//g' -e 's/\[.*\]//g' -e 's/[^ ]\+//' -e 's/^ \+//' < $tmpfile

if [ -f "$tmpfile" ]
then
    rm "$tmpfile"
fi

#
# the includegraphics must be at the same line with the pdf or other figure files included. 

Sunday, May 29, 2011

imapsync

https://fedorahosted.org/released/imapsync/

sync mails from two mail addresses

Saturday, March 12, 2011

R environment

assign("7", "Mountain West", envir = confnameenv);


grep files from results by find

 find /var/ftp/mp3 -name "*.mp3" -type f -exec chmod 644 {} \;
 This command changes the permissions of all files with a name ending in .mp3 in the directory /var/ftp/mp3. The action is carried out by specifying the option -exec chmod 644 {} \; in the command. For every file whose name ends in .mp3, the command chmod 644 {} is executed replacing {} with the name of the file. The semicolon (backslashed to avoid the shell interpreting it as a command separator) indicates the end of the command. Permission 644, usually shown as rw-r--r--, gives the file owner full permission to read and write the file, while other users have read-only access. In some shells, the {} must be quoted.
 copied from http://en.wikipedia.org/wiki/Find