We might have had this one before but I couldn't find it.
cat commafile.txt | tr -dc ',' | wc -c
That could be replaced by any file in the commfile.txt. So, basically count the number of occurrences of the expression ',' in the file and print it out. Why? you ask - cos I gotta.
Friday, July 25, 2008
Wednesday, July 2, 2008
Remote SVN access for Sanger Institute
As usually this config is ripped from various parts of the web, but it allows me to remotely access the SVN at the Sanger Institute. Place this configuration in ~/.ssh/config:
Then type:
to setup the tunnel. You will need to login (and connect to a host). You can then checkout your files, as if you were connected to the local network.
Here is the same for EMBL (couldn't correctly formatted code to comment):
I wanted to do the same to access my machine in EMBL. Here is how.
You then type:
And then:
And then it shoudl be possible to scp stuff using scp mymachine:/path/to/file
Host sangerTunnel
HostName ssh.sanger.ac.uk
Port 22
# Subversion Server
LocalForward localhost:2222 svn:22
###Hostname alias directives###
#These allow you to mimic hostnames as they appear at work.
#We just take the localhost names from the above section and add alias names.
#Note that you don't need to use a FQDN; you can use a short name ,such as smtp instead of smtp.pretendco.com.
Host svn.internal.sanger.ac.uk
HostName localhost
User YOURUSERNAME
Port 2222
#End Config File
Then type:
ssh -v sangerTunnel -lYOURUSERNAME
to setup the tunnel. You will need to login (and connect to a host). You can then checkout your files, as if you were connected to the local network.
Here is the same for EMBL (couldn't correctly formatted code to comment):
I wanted to do the same to access my machine in EMBL. Here is how.
Host emblTunnel
HostName ssh-proxy.embl.de
Port 22
# Subversion Server
LocalForward localhost:2222 svn:22
###Hostname alias directives###
#These allow you to mimic hostnames as they appear at work.
#We just take the localhost names from the above section and add alias names.
#Note that you don't need to use a FQDN; you can use a short name ,such as smtp instead of smtp.pretendco.com.
Host mymachine
HostName localhost
Port 2222
HostKeyAlias mymachine
User nobodycares
You then type:
ssh emblTunnel
And then:
ssh mymachine
And then it shoudl be possible to scp stuff using scp mymachine:/path/to/file
Monday, June 23, 2008
base64 decode
I was playing around with launching the taverna workflow engine programmatically. The answers it spat back out all looked slightly weird.
According to the taverna user group this is cos the answer is encoded in base64. To see how it should look, stick it through mmencode:
A somewhat more comprehensable answer should emerge:
Now to find the java libraries to do this in code.
IyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIwojIFByb2dyYW06IGFudGln
ZW5pYwojIFJ1bmRhdGU6IFRodSAxOSBKdW4gMjAwOCAxMjoyNDo0MgojIENvbW1hbmRsaW5lOiBh
bnRpZ2VuaWMKIyAgICAtc2VxdWVuY2Ugc3dpc3Nwcm90OlAwNDYzNwojICAgIC1vdXRmaWxlICIv
ZWJpL2V4dHNlcnYvc29hcGxhYi13b3JrL3NvYXBsYWIyX2VtYm9zczQvU0FOREJPWC9bcHJvdGVp
bl9tb3RpZnMuYW50aWdlbmljXS0yNTc4NTMyNi
According to the taverna user group this is cos the answer is encoded in base64. To see how it should look, stick it through mmencode:
mmencode -u name.txt
A somewhat more comprehensable answer should emerge:
########################################
# Program: antigenic
# Rundate: Thu 19 Jun 2008 12:24:42
# Commandline: antigenic
# -sequence swissprot:P04637
# -outfile "/ebi/extserv/soaplab-work/soaplab2_emboss4/SANDBOX/[protein_motifs.antigenic]-25785326.11a9e381fc5.67f8/o_outfile"
# -auto
# Report_format: motif
# Report_file: /ebi/extserv/soaplab-work/soaplab2_emboss4/SANDBOX/[protein_motifs.antigenic]-25785326.11a9e381fc5.67f8/o_outfile
########################################
#=======================================
#
# Sequence: P53_HUMAN from: 1 to: 393
# HitCount: 15
#=======================================
Now to find the java libraries to do this in code.
Saturday, June 21, 2008
Vim C++ Autocompletion
Download and install vimcppomnicomplete: http://www.vim.org/scripts/script.php?script_id=1520
Install ctags (not the Emacs version): http://ctags.sourceforge.net/
In /usr/include type:
Add the following to ~/.vimrc:
The final line closes the completion box when you leave insert mode. Ctrl-L will update the tags (and so let you autocomplete based on new files) files in the current directory. Thanks go to the various places on the interwebs I robs this info from.
Install ctags (not the Emacs version): http://ctags.sourceforge.net/
In /usr/include type:
ctags -f ~/.vim/stdtags -R --c++-kinds=+p --fields=+iaS --extra=+q .
Add the following to ~/.vimrc:
set nocp
filetype plugin on
map <C-L> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR><CR>
set tags=~/.vim/stdtags,tags,.tags,../tags
autocmd InsertLeave * if pumvisible() == 0|pclose|endif
The final line closes the completion box when you leave insert mode. Ctrl-L will update the tags (and so let you autocomplete based on new files) files in the current directory. Thanks go to the various places on the interwebs I robs this info from.
Thursday, June 12, 2008
Truecrypt commands
Given that I will probably forget all this I thought it best to write it down.
Create the volume:
Mount that volume:
Unmount it:
All stolen from here:
http://www.movingtofreedom.org/2007/02/10/truecrypt-in-ubuntu-and-fedora-gnu-linux/
Create the volume:
truecrypt --create test.tc
Mount that volume:
truecrypt test.tc /mnt/data/
Unmount it:
truecrypt --dismount test.tc
All stolen from here:
http://www.movingtofreedom.org/2007/02/10/truecrypt-in-ubuntu-and-fedora-gnu-linux/
Wednesday, June 11, 2008
Subscribe to:
Posts (Atom)