Wednesday, December 12, 2007

Yet more things I forget

Really useful list of keyboard short cuts, most I which I routinely find myself forgetting:

http://blog.lxpages.com/2007/06/26/bash-command-line-editing/

ctrl a begining of line, ctrl e end of line, ctrl a begining of line, ctrl e end of line, ctrl a begining of line, ctrl e end of line, ctrl a begining of line, ctrl e end of line, ctrl a begining of line, ctrl e end of line, ctrl a begining of line, ctrl e end of line, ctrl a begining of line, ctrl e end of line, ctrl a begining of line, ctrl e end of line, ctrl a begining of line, ctrl e end of line

Monday, November 26, 2007

Convert from pem files to p12

Today I had to convert my grid certificate *from* the pem files to a p12/pfx file to import into the browser. Lots on google about going the other way, but not back (though I think I'm loosing my google voodoo skills...). So, for the record here's how to do it:

openssl pkcs12 -export -in usercert.pem -inkey userkey.pem -out bundle.p12

Monday, October 08, 2007

Awk the output of top to sort by memory

top -c -n1 -b|grep cmssgm|awk '{for (i=5; i<=NF; i++) {printf("%s ", $i)}printf("\n")}'|sort -n -r

Monday, September 17, 2007

JDL Attributes

http://grid-it.cnaf.infn.it/fileadmin/users/job-submission/job_submission.html

A handy tutorial on writing and running grid jobs. Most useful is:

Requirements  = (!(RegExp(".*nikhef.*",other.CEId)));

Tuesday, August 14, 2007

Vi Search and Replace

Change to normal mode with .

Search (Wraped around at end of file):

Search STRING forward : / STRING.
Search STRING backward: ? STRING.

Repeat search: n
Repeat search in opposite direction: N (SHIFT-n)


Replace: Same as with sed, Replace OLD with NEW:


First occurrence on current line: :s/OLD/NEW

Globally (all) on current line: :s/OLD/NEW/g

Between two lines #,#: :#,#s/OLD/NEW/g

Every occurrence in file: :%s/OLD/NEW/g


copied from http://www.felixgers.de/teaching/emacs/vi_search_replace.html

Friday, August 10, 2007

ls to twiki text

The following is useful when writing twiki documentation on a load of files in a directory:

ls ../PHEDEX/Toolkit/Transfer/|awk '{for (i = 1; i <= 1; i++) print "---++ " $i}'

It will print each file in the directory as a heading for the twiki page. Change as appropriate, for example:

ls ../PHEDEX/Toolkit/Transfer/|awk '{for (i = 1; i <= 1; i++) print " i " $i}'
ls ../PHEDEX/Toolkit/Transfer/|awk '{for (i = 1; i <= 1; i++) print " * " $i}'


makes lists.

Thursday, August 09, 2007

Wednesday, August 01, 2007

Delete files from CASTOR

castordelpath = /castor/ads.rl.ac.uk/prod/cms/store/LoadTest07
for i in `nsls $castordelpath`;
do srm-advisory-delete srm://ralsrmf.rl.ac.uk:8443/srm/managerv1?SFN=$castordelpath/$i;
stager_rm -M $castordelpath/$i;
nsrm $castordelpath/$i;
done

Tuesday, July 31, 2007

FTS commands

Increase number of files on a channel:

glite-transfer-channel-set -s https://lcgfts.gridpp.rl.ac.uk:8443/glite-data-transfer-fts/services/ChannelManagement -f 15 T2ESTONIA-RALLCG2

List details of a channel:

glite-transfer-channel-list -s https://lcgfts.gridpp.rl.ac.uk:8443/glite-data-transfer-fts/services/ChannelManagement T2ESTONIA-RALLCG2

Monday, July 02, 2007

It's been a while...

In the process of doing some thesis corrections I've written a python parser for Les Houche events (more in another post). Anyway it's a nice little utility that writes events into an SQLite database and then make plots using matplotlib. You run it in two ways, first to read the lhe file and then secondly to make the plot.

I've found that the following bash commands are useful when working with the output from Madgraph.

Unzip the unweighted event file for each process:
  • for i in `ls ~/corrections/MadGraph|grep -v tar`; do j=`ls $i/Events/|grep lhe|grep -v gz`; gzip ~/corrections/MadGraph/$i/Events/$j; j=`ls $i/Events/|grep unweighted`; gunzip ~/corrections/MadGraph/$i/Events/$j; done
Run the python parser on the unweighted file:
  • for j in `ls ~/corrections/MadGraph/|grep -v gz`; do python LHEParser.py -f `ls ~/corrections/MadGraph/$j/Events/*.lhe` -d sqlite:////Users/metson/Desktop/$j.db; done; python LHEParser.py -f `ls ~/corrections/Pythia/*.lhe` -d sqlite:////Users/metson/Desktop/Signal.db;
If you delete the text file you may want to skim the output of the parser:
  • for i in `ls ~/Desktop|grep -e "D.db"`; do python LHEParser.py -d sqlite:////Users/metson/Desktop/$i -s; done
Make the plots:
  • python LHEPlotter.py -d ~/Desktop/