(defun ask-upcase-word-backward ( )
"Description: upcase-word-backward"
(interactive) (upcase-word -1))
(defun ask-downcase-word-backward ( )
"Description: downcase-word-backward"
(interactive) (downcase-word -1))
(defun ask-cap-word-backward ( )
"Description: capitalize-word-backward"
(interactive) (capitalize-word -1))
(global-set-key (kbd "s-u") 'ask-upcase-word-backward)
(global-set-key (kbd "s-c") 'ask-cap-word-backward)
(global-set-key (kbd "s-l") 'ask-downcase-word-backward)
;; s- means pressing "super-key" of a window symbol.
elisp functions to change word cases backward in Emacs
To have a wide equation or content in a two-column document: LaTex and Lyx
% in header
\usepackage{cuted}
\usepackage{flushend}
% in document
\begin{strip}
blalblal
\end{strip}
Appendix decoration
Add the following lines at the end of LaTex or Lyx file
\appendix
\setcounter{figure}{0}
\renewcommand\thefigure{A.\arabic{figure}}
\begin{appendices}
\include{AFPD-p9-Appendix}
\end{appendices}
How to include bibliography in ToC of Latex/Lyx
Add the following line in your LaTex/Lyx header.
\usepackage[nottoc,notlot,notlof]{tocbibind}
MATLAB plot, line width
Object-oriented way
l = plot(x1,y1,x2,y2);
l(1).LineWidth = 3; % set line width of 3 for the first line (x1,y1)
l(2).LineWidth = 6;
or typical way
h = plot(x1,y1,x2,y2);
set(h(1),'linewidth',1);
set(h(2),'linewidth',2);
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}
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"))
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
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
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.