Everyone that learned python from me, probably doesn't know these exist. So take note:
kewler than list comprehension: generator expressions (!)
PEP 289 -- Generator Expressions
Tuesday, March 17, 2009
Compare command output on 2 hosts
This works nicely on my 2 compute nodes.
Q: What Software Is Installed On Only One Node?
A:
#!/bin/tcsh
set tmp1 = `mktemp -t computeDiff.csh.c1.XXXXXX`
set tmp2 = `mktemp -t computeDiff.csh.c2.XXXXXX`
onintr exit
foreach cmd ( $argv )
ssh kf-compute1 "$cmd" >! $tmp1
ssh kf-compute2 "$cmd" >! $tmp2
echo "########### $cmd ################"
echo "### diff compute1 compute2"
diff $tmp1 $tmp2
end
exit:
rm $tmp1* >&/dev/null
rm $tmp2* >&/dev/null
# end script
Q: What Software Is Installed On Only One Node?
A:
% computeDiff.csh pkg_info
########### pkg_info ################
### diff compute1 compute2
22a23
> compat6x-amd64-6.4.604000.200810 A convenience package to install the compat6x libraries
24d24
< cvsup-without-gui-16.1h_4 File distribution system optimized for CVS (non-GUI version
34d33
< fastest_cvsup-0.2.9_5 Finds fastest CVSup server
62a62
> iperf-2.0.4 A tool to measure maximum TCP and UDP bandwidth
150d149
< sge-6.2.b Sun Grid Engine, a batch queueing system
Thursday, March 12, 2009
finaly factored out PickleableObject
uses my nonclobbering file opener: safeOFW
I've been meaning to move this from a class that Peter wrote it in to originally at my request. It's quite nice to have it globally available.
class PickleableObject(object):
"""Generic pickleable class
"""
def save(self,filename,clobber=False):
"""given an object, e.g. a taxon dictionary,
pickle it into the specified filename
Set clobber = True to allow overwriting of the
output file"""
import cPickle
f = safeOFW(filename,clobber=clobber,append=False)
cPickle.dump(self,f)
f.close()
@classmethod
def restore(cls,filename):
"""given a filename, return an object containing the
pickled data in that file"""
import cPickle
f = open(filename,'rb')
obj = cPickle.load(f)
return obj
I've been meaning to move this from a class that Peter wrote it in to originally at my request. It's quite nice to have it globally available.
Wednesday, March 11, 2009
Words that nerds use that I hate
distro - "distribution" please
tarball - "tar file" (the fact that it is gzipped, will be obvious to any that care)
architected - the word you are looking for is "designed" n.b. actual architects do not use this word to describe their activities.
sequel - Do you mean "S"-"Q"-"L"? (./ers you know the 'sequel' form is M$ spawn, right?)
tarball - "tar file" (the fact that it is gzipped, will be obvious to any that care)
architected - the word you are looking for is "designed" n.b. actual architects do not use this word to describe their activities.
sequel - Do you mean "S"-"Q"-"L"? (./ers you know the 'sequel' form is M$ spawn, right?)
HealthMap | Global disease alert map
This should go on the lab web page HealthMap | Global disease alert map
Tuesday, February 24, 2009
Subscribe to:
Posts (Atom)