filesize bash scripts

immediate_filesize()
{ cat "`dirname $1`/.(use)(2)(`basename $1`)'" |
grep l= | sed -e's/.*;l=([0-9]*).*/1/'; }
filesize()
{ for try in 1 2 3; do S=`immediate_filesize $1`;
if [ -n "$S" ]; then echo $S; break; else sleep 30; fi; done ; }
Posted in Uncategorized | Tagged , | Comments Off

tell terminal.app

tell application "Terminal"
        activate
        with timeout of 1800 seconds
                do script with command "top"
                tell window 1
                        set background color to "black"
                        set cursor color to "green"
                        set normal text color to "yellow"
                        set bold text color to "red"
                        set title displays shell path to true
                        set title displays window size to true
                        set title displays device name to true
                        set title displays file name to true
                        set title displays custom title to true
                        set custom title to "bozo"
                        set number of columns to 80
                        set number of rows to 40
                end tell
        end timeout
end tell
Posted in Uncategorized | Tagged , | Comments Off

remove first 4 letters in each line

sed 's/^.{4}//g' file
sed -s 's/^[[:alpha:]]{4}//g' file
sed -s 's/^[a-zA-Z]{4}//g' file
Posted in Uncategorized | Tagged | Comments Off

change channel status in fts

for i in `glite-transfer-channel-list` ; do glite-transfer-channel-set -S Drain $i ; done ;
for i in `glite-transfer-channel-list` ; do glite-transfer-channel-set -S Active $i ; done ;
Posted in Uncategorized | Tagged , | Comments Off

MINI Cooper navigation diagnostics

You can see many different version numbers and other diagnostics on a hidden OSD screen (no idea if this works on cars past the 07 model year).

  1. Go to home screen
  2. Hold joystick down for 15 seconds
  3. Turn 3 clicks right
  4. Turn 3 clicks left
  5. Turn 1 click right
  6. Turn 1 click left
  7. Turn 1 click right
  8. Press joystick once
Posted in Uncategorized | Tagged , | Comments Off

lcg-infosites and lcg-info

lcg-infosites --vo cms se --is lcg-bdii.cern.ch
lcg-info --list-se --vo cms  --attrs 'AvailableSpace'
Posted in Uncategorized | Tagged , | Comments Off

find Mac display part number

ioreg -lw0 | grep IODisplayEDID | sed "/[^<]*</s///" | xxd -p -r | strings -6
Posted in Uncategorized | Tagged , , | Comments Off

sum dataset

dbs search --noheader --query="find sum(block.size), dataset where site = T1_SOMESITE”
Posted in Uncategorized | Tagged | Comments Off

sum add columns in a text file

awk 'BEGIN {x=0} {x+=$1} END {print x}' /tmp/z1
awk -F" " 'BEGIN {x=0} {x+=$2} END {print x}' cols
Posted in Uncategorized | Tagged , | Comments Off

procedure to copy files to CERN CASTOR

1. make a directory in the castor area and give it the right permissions (gets the correct mapping):

nsmkdir /castor/cern.ch/user/u/user/a
nschmod 775 /castor/cern.ch/user/u/user/a

2. Use lcg-cp or srmcp:

lcg-cp -v --vo cms
file:////data/user/job/LM1_SUSY_Tree.root
srm://srm-cms.cern.ch:8443/castor/cern.ch/user/u/user/a/LM1_SUSY_Tree.root

or

srmcp -srm_protocol_version=2 -use_urlcopy_script=true -urlcopy=${SRM_PATH}/sbin/url-copy.sh
file:////data/user/job/LM1_SUSY_Tree.root
srm://srm-cms.cern.ch:8443/castor/cern.ch/user/u/user/a/LM1_SUSY_Tree.root
Posted in Uncategorized | Tagged , , | Comments Off