Friday, July 25, 2008

Count chars

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.

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:

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