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

Sunday, February 6, 2011

sqlite3 scripts comments notation

--

-- ********************************************************************
-- Creating a trigger for timeEnter
-- Run as follows:
-- $ sqlite3 test.db < trigger1
-- ********************************************************************
CREATE TRIGGER insert_t1_timeEnter AFTER INSERT ON t1
BEGIN
UPDATE t1 SET timeEnter = DATETIME('NOW') WHERE rowid = new.rowid;
END;
-- ********************************************************************