Often while compiling latex files you need to access the most recent .tex, .ps or .pdf file. Sometimes if those file names are long it is often annoying to write them everytime. Here is a set of commands which will work on the last edited/touched file of the specified type.
alias latex. 'latex `ls -t *.tex | head -1` &'
alias emacs. 'emacs `ls -t *.tex | head -1` &'
alias pdf. 'acroread `ls -t *.pdf | head -1` &'
alias acroread. 'acroread `ls -t *.pdf | head -1` &'
alias ps2pdf. 'ps2pdf `ls -t *.ps | head -1` &'
alias lpr.. 'lpr `ls -t *.ps | head -1` &'
alias gv. 'gv `ls -t *.ps | head -1` &'
alias gvl. 'gv --orientation=landscape `ls -t *.ps | head -1` &'
alias lpr. 'lpr `ls -t *.ps | head -1` &'
alias lpdf. 'lpdf `ls -t *.pdf | head -1` &'
Monday, June 28, 2010
Combine several pdf files using ghostview
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=all.pdf -dBATCH a.pdf b.pdf c.pdf
Opening display configuration from commandline
Often in a dual head one of the screens is stuck. You can open the display configuration using
sudo /usr/bin/system-config-display
and then when nvidia refreshes ... just cancel the configuration. You will get you screens back without having to Ctrl-Alt-Backspace
sudo /usr/bin/system-config-display
and then when nvidia refreshes ... just cancel the configuration. You will get you screens back without having to Ctrl-Alt-Backspace
Tuesday, August 7, 2007
Using grep with find
This is how you can use find to first restrict to all .r files and then use grep on them
find . -name "*.r" -exec grep "rho" '{}' \; -print
find . -name "*.r" -exec grep "rho" '{}' \; -print
Using grep with find
This is how you can use find to first restrict to all .r files and then use grep on them
find . -name "*.r" -exec grep "rho" '{}' \; -print
find . -name "*.r" -exec grep "rho" '{}' \; -print
Friday, June 8, 2007
Attach files to thunderbird directly from commandline
Install the script ( e.g attach.sh )
#! /bin/bash
#
# Script created by ASID
# Modified by sura
# Attach files to thunderbird
temp=""
count=0
mydir=`pwd`
for i in $*
do
count=$(( $count + 1 ))
if [ $count -eq $# ]
then
temp=${temp}file://${mydir}/${i}
else
temp=${temp}file://${mydir}/${i},
fi
done
echo $temp
if thunderbird -remote "ping()" 2> /dev/null ;
then
thunderbird -remote "xfeDoCommand(composeMessage,attachment='$temp')"
else
thunderbird --compose "attachment='$temp'"
fi
Then just issue the command
bash attachs.sh filenames
#! /bin/bash
#
# Script created by ASID
# Modified by sura
# Attach files to thunderbird
temp=""
count=0
mydir=`pwd`
for i in $*
do
count=$(( $count + 1 ))
if [ $count -eq $# ]
then
temp=${temp}file://${mydir}/${i}
else
temp=${temp}file://${mydir}/${i},
fi
done
echo $temp
if thunderbird -remote "ping()" 2> /dev/null ;
then
thunderbird -remote "xfeDoCommand(composeMessage,attachment='$temp')"
else
thunderbird --compose "attachment='$temp'"
fi
Then just issue the command
bash attachs.sh filenames
Thursday, April 19, 2007
Setting new keyboard macro in emacs
The process is described here
Here is the final entry in your init.el file.
(fset 'newslide
[?\C-7 ?\C-7 ?% return ?% ?% ?% ?% ?% ?% ?% ? ? ?N ?E ?W ?\S- ?S ?L ?I ?D ?E return ?\C-7 ?\C-7 ?% return return ?\\ ?b ?e ?s ?{ ? ? ?} return return ?\\ ?e ?s return return])
(global-set-key [f8] 'newslide)
Now just press F8 and you will get an entry like
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%% NEW SLIDE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bes{ }
\es
which I used as demarcation while preparing latex slides
WOW you can type so much using just one key stroke :)
Here is the final entry in your init.el file.
(fset 'newslide
[?\C-7 ?\C-7 ?% return ?% ?% ?% ?% ?% ?% ?% ? ? ?N ?E ?W ?\S- ?S ?L ?I ?D ?E return ?\C-7 ?\C-7 ?% return return ?\\ ?b ?e ?s ?{ ? ? ?} return return ?\\ ?e ?s return return])
(global-set-key [f8] 'newslide)
Now just press F8 and you will get an entry like
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%% NEW SLIDE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bes{ }
\es
which I used as demarcation while preparing latex slides
WOW you can type so much using just one key stroke :)
Subscribe to:
Posts (Atom)