Latex scientific notation, made easy
\providecommand{\e}[1]{\ensuremath{\times 10^{#1}}}
Then, typing
The [111] crystal planes are 3.2\e{-10} m apart.
http://www.tapdancinggoats.com/easy-scientific-notation-in-latex.htm
R plot magic
To move the axis labels/lines:
par(mpg=c(, , ))
default is mpg=c(3,1,0), but mgp=c(1.75, 0.5, 0) works
To move margins:
par(mar=c(,,,))
default is mar=c(5,4,4,2)+0.1, but mar=c(3,3,0,0)+0.1 works
Using awk to randomly sample a file
Create a file with 1000 lines:
for i in {1..1000};do echo $i; done > f
export P=0.5
cat f | awk -v p=$P 'BEGIN{srand()} {r = rand(); if (r <= p) print}'
leave a comment