SVN : How to restore an older version of my current file ?

I want to restore an older version (from the SVN revision number 1289) of my current file fic.pl, what can I do ? 

Here is the tips (NB my current revision is 1492) :

[npene@donunix] svn merge -r 1492:1289 fic.pl

[Perl] One liner calculus

In the following example file « calc.txt », I want to multiply each number by 2/3 :

199,119
326,147
385,345
250,330
157,218
67,241
402,175

Here is the solution in one line with Perl :

[pene@donunix] perl -pi.bak -e 's|(\d+),(\d+)|int($1*2/3).",".int($2*2/3)|e' calc.txt

How to convert a string to upper or lower case ?

[pene@donunix] var=`echo $var | tr [a-z] [A-Z]`

Twitter : display your rate limit per hour

[pene@donunix]  curl -u twitter_name:twitter_password http://twitter.com/account/rate_limit_status.xml

N.B. : For information, the default rate limit is 100 requests per hour.

grep: advanced use

How to display all lines with the word text or the word name?
Here is the answer:

[pene@donunix] grep -P 'text|name' file.txt

find and only print files located in subdirectories

[pene@donunix] find . -maxdepth 2 -mindepth 2

SSH : Public keys generation

The purpose of this short post is to explain how being connected to an ssh server without typing the password, how ?
With the generation of public ssh keys.

I. Client : Generation of public keys

First (just for the first time) you have to genere the 2 keys :
[donunix@client] ssh-keygen -t dsa

During the dsa key generation, ssh-keygen ask you to enter a path phrase (it replace the password system). type [enter] if you doesn't what to genere a path phrase.

The 2 keys are in the ~/.ssh directory :
[donunix@client] ls ~/.ssh/id_dsa*
id_dsa id_dsa.pub

  • id_dsa is the private key
  • id_dsa.pub is the public key to send too the server

Client : send to the server the public keys

copy the public keys to the server :
[donunix@client] scp .ssh/id_dsa.pub user@server:.ssh/client.pub

Server : Record the client public keys

Connect to the server :
[donunix@client] ssh donunix@server

record the keys on the .ssh/authorized_keys file :
[donunix@server] cd .ssh
[donunix@server] cat client.pub >> autorized_keys

And that's all folk ;)
You can now run ssh sessions without typing your password.