How to generate a fixed format, sequential integers

The following bash script is to generate integers from 1 to 11, having 3-digit format.

#!/bin/bash
for i in `seq -f "%03g" 1 11`
do
   echo $i
done 
exit 0 

The result is as follows.

 001
 002
 003
 004
 005
 006
 007
 008
 009
 010
 011
Posted in Uncategorized | Tagged ,

Specific header settings of Emacs org-mode for LaTex export

#+LATEX_HEADER: \usepackage[margin=1.0in]{geometry}
#+LATEX_HEADER: \usepackage[numbers,sort&compress,square]{natbib}
#+latex_header: \usepackage{glossaries}
#+latex_header: \makeglossaries
#+latex_header: \usepackage{setspace} \singlespacing
#+latex_header: \usepackage{enumitem}
#+latex_header: \setlist[itemize]{noitemsep, topsep=0pt}
#+latex_header: \setlist[enumerate]{noitemsep, topsep=0pt}
#+OPTIONS: d:nil ^:nil H:2 toc:nil
  • 1st line: setting all four side margins, 1 inch.
  • 2nd line: natbib setup for numbered references of which citation is sorted and compressed, i.e., instead of [1,2,3,4] it will show [1-4].
  • 3rd and 4th: nomenclature setup
  • 5th line: linespacing setup, single and double
  • 6th and 7th lines: setting line gaps between enumerated and itemized ones zero.
Posted in Blog | Tagged , ,

Learn The Entire Python Language In A Single Image (link)

An interesting page that contains a single image for python language. Here.

Image link: Here

Posted in Uncategorized

How to replace the 4th occurrence of a character in a file using sed

sed -i "s/\"/ \"/4" myFile.txt

The above command will replace the 4th occurrence of by in file “myFile.txt”, which is equivalent to putting a space in front of the 4th double quote.

Posted in Uncategorized | Tagged

How to change an extension of many files

In a Linux terminal:

$ for f in *.txt; do mv -- "$f" "${f%.txt}.text"; done

will rename all *.txt to *.text files.

Posted in Uncategorized

How to compile .tex file without stopping

Method 1: using pdflatex to generate a pdf file

$ pdflatex   -interaction   nonstopmode   myTexFile.tex  

Method 2: using latexmk to generate a dvi file.

$ latexmk   myTexFile.tex 
Posted in Uncategorized

How to write output values to the standard output without carriage return in FORTRAN

How to write output values to the standard output without carriage return:

program tstNoadv
 integer :: i
 do i = 1, 10
 write(*,"(A1,I6.4,$)") char(13), i
 call system("sleep 1")
 end do
 write(*,*) "Done"
 stop
end program
Posted in Uncategorized | Tagged