Showing posts with label howto. Show all posts
Showing posts with label howto. Show all posts

Tuesday, February 03, 2009

install new latex package

Download
2. move .sty file to ..textmf/tex/latex/package-name/
3. if no .sty file .run latex on the .ins file
4. type texhash

from: http://avizit.blogspot.com

Wednesday, November 12, 2008

Access to serial port

In order to get rid of the error

you don't have +rw permission to access serial port

you need to add your user to the uucp group

> ls -l /dev/ttyS0
crw-rw---- 1 root uucp 4, 64 Nov 12 18:44 /dev/ttyS0

/usr/sbin/usermod -a -G uucp my_username

Tuesday, October 14, 2008

split multiple-pages pdf in multiple files

gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=epswrite -sOutputFile=result-%02d.eps /tmp/infile.pdf

then eps2pdf

Monday, October 13, 2008

skype on SLC4

Tried to install skype on SLC4.
Can only get the latest version (2.0.0.72) from skype.com (cannot find older versions around).
Download the statically linked package from http://www.skype.com/go/getskype-linux-static
Unpack in /usr/local/share/skype; it complains about

/skype: /usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.4' not found

Need more recent stdc++ library (using gcc version 3.4.6 from /usr/bin/gcc);
get gcc-4.2.1 from http://gcc.gnu.org. Then configure; make; make install.
Change the symbolyc link so that it points to the new library

/usr/lib/libstdc++.so.6 -> /usr/local/lib/libstdc++.so.6.0.9

Now skype starts without much complaining. I can hear sounds, but
cannot speak. Kill artsd (don't know, might not be the problem),
change settings with alsamixer. Then from the skype settings switch
from the default audio device to the 4th one (otherwise
"Call Failed: Problem with Audio Playback" ).
Now it seems to work (can hear my voice back during test call), but I might
have to adjust the mic volume.

Note: set audio device different from the default one for input/output/ringing, not only for output

Friday, August 29, 2008

find and grep

few ways to see which files contain a string

find . -name \*config -print -exec grep "sam:" {} \; > /tmp/find_out

grep -H -r "sam:" ./
grep -lir "text to find" *
grep -i -n ‘text to search' *
grep --with-filename --line-number `find -type f`

Monday, May 26, 2008

how to concatenate pdf

gs -q -sPAPERSIZE=letter -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf in3.pdf

Friday, May 09, 2008

emacs text mode menubar

On text-only terminals with no mouse, you can use the menu bar by typing M-' or (these run the command tmm-menubar).

from
http://linux.about.com/od/emacs_doc/a/emacsdoc317.htm

Wednesday, April 09, 2008

convert std::iterator to int index

#include <vector> ;
#include <algorithm> ;

std::vector<double> a;
a.push_back(3.); a.push_back(5.); a.push_back(9.);
std::vector::iterator it = std::find(a.begin(),a.end(),9.);
int index = it - a.begin();

Saturday, October 27, 2007

linux laptop burn cd

To burn cd from command line on my laptop
I need to do something like
cdrecord dev=ATAPI:1,0 -data filename.iso
Without "dev=..." cdrecord doesn't work for
some funny reason.

Saturday, July 14, 2007

tcsh loop with variable names

tcsh script to rename files modifying the name

> foreach X ( *03.root )
foreach? set newname=`echo $X | sed s/iteration03/iteration04/`
foreach? mv $X $newname ;
foreach? end

Also, using variables with sed :
> foreach X (E002 E004 E005 E009 E020 E030 E050 E100)
or

> foreach X ( `ls /data1/gerbaudo/1_5_2/mc-pi-hepmc-ca* | cut -d "_" -f 4` )
foreach? sed "s/E000/$X/g" templateE000.cfg > $X.cfg ;
foreach? end

Friday, July 06, 2007

kubuntu systemsettings window

The "system settings" window on kubuntu is too big (doesn't fit on my screen 1024x768); this unpleasant feature (bug?) has been there since quite a long time.
Now I found a trick: rather than running "system settings" run "kcontrol": the same menus are available, but there's no problem with the window size.

Sunday, June 10, 2007

FermiId

If you want to know your FermiId (I didn't find any easy web-display):
login on a fnal machine
$> ssh fnalu.fnal.gov
then
$> setup telephone
$> telephone -id gerbaudo

Friday, June 08, 2007

tar through ssh

tar cf - ./PORTISHEAD-02-DUMMY | ssh pucms1 tar xf - -C /tmp/gerbaudo/

Thursday, June 07, 2007

find file in a date range

# find files modified in the first quarter of 2007
touch -t 200701010000 /tmp/newerstart
touch -t 200703312359 /tmp/newerend

find tmp \( -newer /tmp/newerstart -a \! -newer /tmp/newerend \) -print

checking quota

How to check your quota on
  • lxplus: fs listquota (fs lq)
  • fnal: quota -s

Tuesday, June 05, 2007

more CMSSW cvs

some more examples: using tags and checkout to a directory:

cvs tag -R -r "my_tag" ./Tutorial/MyPackage

mkdir ./Tutorial
cvs co -PA -r "working_with_CMSSW_1_3_0" -d ./Tutorial UserCode/gerbaudo/Tutorial

N.B. the "A" flag is essential, otherwise you'll be stuck with sticky tags and you won't be able to commit changes...

Wednesday, May 30, 2007

CMSSW cvs

  • from cern:
project CMSSW
kinit
cvs co UserCode/gerbaudo

  • from princeton:
setenv CVSROOT :kserver:cmscvs.cern.ch:/cvs_server/repositories/CMSSW
kinit -cell CERN.CH
cvs co UserCode/gerbaudo

  • from fnal:
project CMSSW
kserver_init
(this method is suggested in https://twiki.cern.ch/twiki/bin/view/Main/CMSSWatFNALSETUP but now it doesn't work for me)
OR
setenv CVSROOT :ext:cmscvs.cern.ch:/cvs_server/repositories/CMSSW
setenv CVS_RSH ssh
cvs co UserCode/gerbaudo

concatenate ps files

gs -q -dNOPAUSE -dBATCH -sDEVICE=pswrite -sOutputFile=full.ps ...

Tuesday, April 17, 2007

Emacs jump at matching {}

M-C-b and M-C-f (backward-sexp and forward-sexp)