Wednesday, April 30, 2014

count a character in each line

for example, if I want to check if a CSV file without quotes is valid, something like the following might help:

tr -d -c ',\n' < file | awk '{print length;}' | uniq


Friday, April 25, 2014

capture.output function in R

Once I was wondering how to return string from function str().  I guess capture.output is one way:

capture.output              package:utils              R Documentation

Send Output to a Character String or File

Description:

     Evaluates its arguments with the output being returned as a
     character string or sent to a file.  Related to 'sink' in the same
     way that 'with' is related to 'attach'.

Usage:

     capture.output(..., file = NULL, append = FALSE)

Arguments:

     ...: Expressions to be evaluated.

Tuesday, March 25, 2014

vim copy highlighted to

 In order not to retype the pattern that just have been used in search, one can press Ctrl+R, / to automatically insert last search pattern.

Monday, March 17, 2014

Fwd: Mac print to PDF without margin

We need to create a customized page size of say letter with margins being of zero inch. 


Thursday, March 6, 2014

backref put page number in the reference list

\usepackage[pagebackref]{hyperref}

Friday, January 24, 2014

delete all unread message in gmail in a second

  1. Input in:inbox is:unread to the search box:

  2. select all and then delete.