Wednesday, April 28, 2010

Avoid warning when access remote server via ssh with multiple accounts on one client.

AT.
If you put all the public key of local client on the server, and then you connect it via ssh, it will promote a warning.
Warning: the RSA host key for 'a.b.com' differs from the key for the IP address 'x.x.x.x'.

This happened because the ssh server check the key according to the IP address, and since we have multiple account on local client,The server will recored different RSA key from a unique IP,It will result in conflict.

It could be solved by setting the option,
check out ssh_option(5)
e.g sudo -u super_a ssh -o checkhostip="no" username@remote_host 'echo "hi"'.

Friday, April 23, 2010

study notes

umask value
if the previous default permission for file is XXX,set the default permission to XXX &~ $value
perl Number 
$n = 1234; # decimal integer
$n = 0b1110011; # binary integer
$n = 01234; # octal integer
$n = 0x1234; # hexadecimal integer
$n = 12.34e-56; # exponential notation
$n = "-12.34e56"; # number specified as a string
$n = "1234"; # number specified as a string


use taglist to improve vim
1 download Exuberant ctags extract it, add the dir to PATH.
2 download taglist plugin extract it to ~/.vim/
3 restart vim,run :TlistOpen in vim
4 done 
you may want to read



example of vim setting 

set nobackup
set nu
set tabstop=4 " numbers of spaces of tab character
set shiftwidth=4 " numbers of spaces to (auto)indent
set ignorecase " ignore case when searching
behave mswin
"taglist

let Tlist_Sort_Type = 1 "list the tag by name alphabetic
let Tlist_GainFocus_On_ToggleOpen =1 "jump on one click
let Tlist_Auto_Highlight_Tag=1 "Automatically highlight the current tag in the taglist.
let Tlist_Auto_Update =1 "Automatically update the taglist to include newly edited files.
let Tlist_Exit_OnlyWindow =1 "Close Vim if the taglist is the only window.

Tuesday, April 20, 2010

cygwin set display languge

add 
export LANG='C.UTF-8'
to set the language to English.
or
export LANG='zh-CN'
to set the language to Chinese .

Wednesday, April 14, 2010

study note

Perl sort a hash
1 sort by key
foreach $key (sort (keys(%hash_name))) {
  print "\t\t$key \t\t$hash_name{$key}\n";
}
2 sort by $value 
make use of perl sort
 foreach my $key ( sort { $rules{$a} <=> $rules{$b} } ( keys %hash_name ))
{
  print "$key => $hash_name{$key}\n";
}
if you want get the set sorted numeric and desc
switch $a and $b e.g

 foreach my $key ( sort { $rules{$b} <=> $rules{$a} } ( keys %hash_name ))
{
print "$key => $hash_name{$key}\n";
}

Tuesday, April 13, 2010

study notes

getopts for perl?
check out
my %options=();
getopts("a",\%options) or usage();

#HELP_MESSAGE();
addrule() if defined $options{"a"};
sub HELP_MESSAGE()
{
$Getopt::Std::STANDARD_HELP_VERSION=1;
usage;
}
sub VERSION_MESSAGE()
{
$Getopt::Std::STANDARD_HELP_VERSION=1;
#print `grep "^# VERSION" ./odssvn.pl`;
}

TEST;
perl t.pl --help
perl t.pl --version
perl t.pl -a

MD5 for perl

use Digest::MD5;

$ctx = Digest::MD5->new;
$ctx->add($data);
$ctx->addfile(*FILE);
$digest = $ctx->digest;
$digest = $ctx->hexdigest;
$digest = $ctx->b64digest;

Thursday, April 08, 2010

gvim set nobackup

do not generate filename~ file.
try Edit->start setting-> add "set nobackup " under source $VIMRUNTIME/mswin.vim
done


study note


1 To change the owner of the file program.c:

chown jim program.c

The user access permissions for program.c now apply to jim. As the owner, jim can use the chmod command to permit or deny
other users access to program.c.


准备户口迁回家

现在算是口袋户口,身份证还有5年就要到期了,而且要是掉了还超级麻烦的样子。所以准备迁户口。
2从学校迁出 厦大派出所电话 0592-2185893,所需材料,户口页,毕业证,户口迁入地提供的证明。
 迁入地重庆老家 重庆户籍室电话 023-63962385
 太龙镇 派出所电话023-58501035
 万州区户政科电话 64880012
1写申请,表明迁入意愿,原因。到向坪社区(找冯春喜)里盖章,然后交给镇派出所 并包括毕业证复印件,新身份证照片(需要身份证制定点)。(本来可能需要本人办,但是乡下好办事,让家人托办就可以了)
 迁入地(太龙)派出所会给出迁出地所需的证明。
 然后到迁出地(厦大)办,
 然后到迁入地(太龙)办。
计划周末去照相,复印毕业证,用快递寄回家让办。

中国的户籍制度真是太可恶啦。