How to convert a pdf file into sequentially numbered images and animated gif

pdftoppm -rx 300 -ry 300 -png myPDFfile.pdf img
pdftoppm -rx <dpi-x> -ry <dpi-y> -<image-format> <input-pdf-file> <image-file-pre-fix>
  1. The above command in Linux will convert each page of the pdf file “myPDFfile.pdf” into sequentially numbered png files of the file names starting with “img” such as
    img-01.png
    img-02.png
  2. Options “-rx 300 -ry 300” means that 300 dpi is used for both x and y coordinates.

convert -delay 3000 -loop 0 img*.png myimage.gif
convert -delay <time-interval> -loop <loop-number> <imagge-file-prefix>*.png <output-gif-file>
  1. The above command read all the png files, starting with “img” and convert the image files into a single animated gif file, myimage.gif.
  2. The “-delay” option indicate the interval between two images in millisecond. So, “-delay 3000” means 3 seconds between two slide images.

Posted in Uncategorized | Leave a comment

Output and Error redirect

$ command 2> /dev/null 1>&2

which is to

  • first redirects stderr to /dev/null and then
  • redirects stdout to point to the same place stderr is currently pointing to.
Posted in Uncategorized | Leave a comment

How to include multiple authors with different affiliations in LaTex

\usepackage{authblk}
\author[1]{Author A\thanks{A.A@university.edu}}
\author[1]{Author B\thanks{B.B@university.edu}}
\author[1]{Author C\thanks{C.C@university.edu}}
\author[2]{Author D\thanks{D.D@university.edu}}
\author[2]{Author E\thanks{E.E@university.edu}}
\affil[1]{Department of Computer Science, \LaTeX\ University}
\affil[2]{Department of Mechanical Engineering, \LaTeX\ University}

\renewcommand\Authands{ and }

Posted in Uncategorized | Leave a comment

LaTex Appendix in Elsevier template

\appendix
\setcounter{figure}{0}
\renewcommand\thefigure{A.\arabic{figure}}
\addcontentsline{toc}{section}{Appendix}

%\counterwithin{figure}{section}
%\numberwithin{equation}{section}
%\numberwithin{figure}{section}
%\numberwithin{table}{section}
Posted in Uncategorized | Leave a comment

Network command on Ubuntu

to add new gateway

route add default gw 192.168.0.1

to see the network adapter information

nmcli dev show eth0

to restart network

./init.d/networking restart

to see dns stauts

systemd-resolve --status
Posted in Uncategorized | Leave a comment

how to install wordpress and mysql

Sat Nov 23 13:52:24 HST 2019

Posted in Uncategorized | Leave a comment

reconstructPar background script

#!/bin/bash
#+TITLE: check-reconstructPar
#+File:  check-reconstructPar.sh
#+Date: Sat Nov  9 12:23:24 HST 2019
#+Author: Albert S. Kim, albertsk@hawaii.edu
# Required package: bc
#

. ~/.bashrc 
. /home/albertsk/OpenFOAM/OpenFOAM-v1906/etc/bashrc
. $WM_PROJECT_DIR/bin/tools/CleanFunctions
. $WM_PROJECT_DIR/bin/tools/RunFunctions

testProcessorNum=0

processor=`ls  processor${testProcessorNum}  | grep -v [a-zA-Z] | tail -n 1`
latestPWD=`ls  ./ | grep -v [a-zA-Z] | tail -n 1`

Tprocessor=$(echo $processor + 0 | bc)
TlatestPWD=$(echo $latestPWD + 0 | bc)
#
runMessage=$(grep Time log.interFoam2 | tail -n -1)

echo "The running time is" ${runMessage} 
echo "The lastest time in processor${testProcessorNum} is  ${processor}. "
echo "The lastest time in this directory is  ${latestPWD}."

dateTime=`date +"%Y-%m-%d-%H-%M-%S-%p"`
if [ "$Tprocessor" != "$TlatestPWD" ] 
then
    . /home/albertsk/OpenFOAM/OpenFOAM-v1906/etc/bashrc
    . $WM_PROJECT_DIR/bin/tools/CleanFunctions
    . $WM_PROJECT_DIR/bin/tools/RunFunctions
    echo reconstructPar -time $processor
    mv -f log.reconstructPar log.reconstructPar.$dateTime
    mv -f log.reconstructPar.log .reconstructPar.$dateTime
    reconstructPar -time $processor
    mv -f log.reconstructPar  log.reconstructPar.$dateTime
    
else
    echo "This case is laready reconstructed. reconstructPar not necessary!"
fi

exit 0
Posted in bash, OpenFOAM | Leave a comment

Alternative to ESC in vim editor

If you have an American English keyboard, pressing Ctrl-[ (control plus left square bracket) is equivalent to pressing Esc. This provides an easy way to exit from insert mode.

https://vim.fandom.com/wiki/Avoid_the_escape_key

Posted in Uncategorized | Leave a comment

Lyx beamer, how to align each frame top-aligned

Posted in Uncategorized | Leave a comment

How to avoid warning messages from hyperref package in LaTex

\usepackage[unicode=true,pdfusetitle,
   bookmarks=true, 
   bookmarksnumbered=false, 
   bookmarksopen=false,
   breaklinks=false, 
   pdfborder={0 0 1}, 
   backref=false, 
   colorlinks=false]{hyperref}

\hypersetup{pdfauthor={Name}}

Use of hyperref package in a LaTex script makes the manuscript more visually understandable, but it often gives warning message like

Package hyperref Warning: Token not allowed in a PDF string (Unicode): (hyperref) removing `math shift' on input line 79.
Package hyperref Warning: Token not allowed in a PDF string (Unicode): (hyperref) removing `superscript' on input line 79.
Package hyperref Warning: Token not allowed in a PDF string (Unicode): (hyperref) removing `math shift' on input line 79.                     

Then, putting the snippet

\hypersetup{pdfauthor={Name}}

in a LaTex source file will remove the warning message or within the Lyx preamble section.

Posted in Uncategorized | Leave a comment