LaTex/Lyx

To restart figure and table numbers in Appendix with correct link

In the LaTex/Lyx header, add the following package:

\usepackage{chngcntr}

Where the Appendix start, add the following script:

\appendix
\counterwithin{figure}{section} 
\counterwithin{table}{section}
\renewcommand{\thefigure}{A.\arabic{figure}}
\renewcommand{\thetable}{A.\arabic{table}}
% If figure/table numbers follow thos of the previous section, add: 
%\setcounter{figure}{0}
%\setcounter{table}{0}  

Posted in Uncategorized | Leave a comment

Emacs word wrap and replace space by dash

(defun ttl ()
"To apply word wrap in an entire document file"
(interactive)
(toggle-truncate-lines))

;; to replace " " between words by dash "-".
(fset 's2d (kmacro-lambda-form [? ?r ? return ?- return ?!] 0 "%d"))

Posted in Uncategorized | Leave a comment

How to obtain CPU and memory information of Ubuntu system

cat /proc/cpuinfo | grep "model name"   

Command line

cat /proc/meminfo
free -m
vmstat -s

TUI

top
htop

Posted in Uncategorized | Leave a comment

How to use dolphin as a file manager to open a download directory

Open up /usr/share/applications/defaults.list and change line

inode/directory=nautilus.desktop 

to

inode/directory=kde4/dolphin.desktop 

Source URL: https://askubuntu.com/questions/2495/how-can-i-get-firefox-to-use-dolphin-instead-of-nautilus

Posted in Uncategorized | Leave a comment

How to screen capture every 3 seconds

#!/bin/sh
prefix="myScreen"
while true
do
   scrot -d 3 -u "${prefix}_$(date +%y%m%d_%H%M%S)".png
done

                                                                                                                         
Usage : scrot [OPTIONS]… [FILE]
Where FILE is the target file for the screenshot.
If FILE is not specified, a date-stamped file will be dropped in the
current directory.
See man scrot for more details
-h, –help display this help and exit
-v, –version output version information and exit
-b, –border When selecting a window, grab wm border too
-c, –count show a countdown before taking the shot
-d, –delay NUM wait NUM seconds before taking a shot
-e, –exec APP run APP on the resulting screenshot
-q, –quality NUM Image quality (1-100) high value means high size, low compression. Default: 75. For lossless compression formats, like png,
low quality means high compression.
-m, –multidisp For multiple heads, grab shot from each
and join them together.
-s, –select interactively choose a window or rectangle with the mouse
-u, –focused use the currently focused window
-t, –thumb NUM generate thumbnail too. NUM is the percentage of the original size for the thumbnail to be, or the geometry in percent, e.g. 50×60 or 80×20.
-z, –silent Prevent beeping

SPECIAL STRINGS
Both the –exec and filename parameters can take format specifiers
that are expanded by scrot when encountered.
There are two types of format specifier. Characters preceded by a ‘%’
are interpreted by strftime(2). See man strftime for examples.
These options may be used to refer to the current date and time.
The second kind are internal to scrot and are prefixed by ‘$’
The following specifiers are recognised:
$f image path/filename (ignored when used in the filename)
$m thumbnail path/filename
$n image name (ignored when used in the filename)
$s image size (bytes) (ignored when used in the filename)
$p image pixel size
$w image width
$h image height
$t image format
$$ prints a literal ‘$’
\n prints a newline (ignored when used in the filename)
Example:
scrot ‘%Y-%m-%d_$wx$h_scrot.png’ -e ‘mv $f ~/images/shots/’
Creates a file called something like 2000-10-30_2560x1024_scrot.png
and moves it to your images directory.

Posted in Uncategorized | Leave a comment

How to search specific email message in Thunderbird

Install thunerlink at https://github.com/mikehardy/thunderlink

$ thunderbird -thunderlink thunderlink://messageid=<message id>

Posted in Uncategorized | Leave a comment

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