Wednesday, March 28, 2007
Get resource from Wikipedia all the time!
Wikipedia is a wonderful place to many kinds of resouce, but unfortunately, it is not avaiable all the time in my country :(
To work around this, the following links are valuable for me:
http://en.wikilib.com
http://feedbus.com/wikis/wikipedia.php
Sunday, March 18, 2007
use convmv to convert file name's encoding
I find this tool in a serie articles at www.linux.com "Tools & Utilities , CLI Series"[http://enterprise.linux.com/article.pl?sid=06/03/27/2040218&tid=13&tid=89]. Seems interesting, check it out.
Monday, March 12, 2007
[irssi] eye candy in irssi
I found a funny script for irssi, that use a tool named [figlet] to display large characters made up of ordinary screen character. And the script understands the color format control code in irssi, so with it you can create some outstanding colorful characters!
To use it, first install figlet tool: download the figlet script and put it into ~/.irssi/scripts folder, then in irssi run "/load script figlet" to load the script.
In irssi, input "/figlet ^C2 foo ^C4 bar" will generate following: [
][2]
[irssi] completion in irssi
in irssi, you can define as many completions as you like by simply input command:
/completion ty thank you
/completion -auto ltns long time for no see
so when you input 'ty' and press Tab, then 'ty' will be replaced by 'thank you'. If you use -auto option, then when you input 'ltns', to get the completion, you can press Tab or just press space. Simple and powerful. Try it!
Saturday, March 10, 2007
[Irssi] Irssi rocks!
I heard irssi before, but only one week ago I start to learn it. Within this week, I am excited on the wonderful experience of irss. If you are like me: I focus on highly configurable, efficient, powerful, easy to extend. And the most important thing is it is command line based(so I can use it locally or remotely). If you are not interested on these features, then you can skip my post now(I hope not ;) ).
screenshots first:
NOTE: there are tens of screenshots at http://www.irssi.org/themefiles , if you want to see more screenshots before you decided to try it on my computer.
The main features of irssi are at http://www.irssi.org/about .
I am still learning functions of irssi, but based on what I learned till now, it is really worth you having a try!
I will post more in future!
NOTE: there are tens of screenshots at http://www.irssi.org/themefiles , if you want to see more screenshots before you decided to try it on my computer.
The main features of irssi are at http://www.irssi.org/about .
I am still learning functions of irssi, but based on what I learned till now, it is really worth you having a try!
I will post more in future!
Saturday, March 3, 2007
[ssh]: How to solve "Pseudo-terminal will not be allocated..."
in ssh manual:
-T Disable pseudo-tty allocation.
-t Force pseudo-tty allocation. This can be used to execute arbi-
trary screen-based programs on a remote machine, which can be
very useful, e.g., when implementing menu services. Multiple -t
options force tty allocation, even if ssh has no local tty.
So to ssh to nordicserver directly out of office, we can run:
$ ssh -A box -t 'ssh nordicserver'
I got this tip from http://terrencemiao.com/Webmail/msg00921.html
For more ssh details, read ssh man page.
Friday, March 2, 2007
[Perl Learning]: Consider Perl as a tool instead of a programming language
Perl vs Python(or some other similiar language) is just like Vim vs Emacs, it is painful to choose which one to learn. Both are very powerful and have tons of fans. At first, I had no idea which one is suitable for my requirement. The first day I think Perl is compact and powerful; The second day, I think the codes written in Python are more readable.
After I hesitated for several days between them, I chose Python in the end. But I still had a problem that I don't want to refuse Perl since some features of Perl is really cool: the syntax is compact, powerful and CPAN is very good. In fact, I want to use Perl to do small daily tasks, especially in terminal. Yes! Use Perl as a tool, just like sed,awk,grep, instead of programming language! A powerful and complete tool that includes complete data structure, powerful(maybe the most powerful) regular expression, many functions, lots of modules etc.
After thinking it clear, I can not feel better now! ;)
Enjoy powerful tools!
[Perl Learning]: A wonderful book for perl one-liner
"""
/START REGEX/ .. /STOP REGEX/ and print ;
Prints all records between the first containing "START REGEX" and the first containing "STOP REGEX" (which could be the same record), and then repeats that process, looking for the next record containing "START REGEX", etc.
/START REGEX/ ... /STOP REGEX/ and print ;
Same as the two-dot form, except the first evaluation of STOP REGEX doesn't occur until after the record that yielded True for START REGEX has already been processed, thereby preventing both patterns from mathing the same record.
"""
for example:
$ perl -w -nle '/Oct 19/ ... /Oct 20/ and print '
Above texts comes from Book <>, that is a really good book for me. It focuses on use perl to replace other legacy Unix command like grep, sed, awk etc. It describes perl one-liner in details, that is just the way which I want to use perl in.
Strongly recommended! ;)
Thursday, March 1, 2007
[Perl Learning]: use single quote always
When use one-liner perl command , use single quote always.
Because when you use double quote, the commands within double quote will be expanded by shell first, most of the time, that is NOT what I want. And the worst thing is it is not easy to find out sometimes. So use singel quote always.
[Perl Learning]: pay attention to s/.../.../ trap
perl command s/.../.../ will return how many thing has been replaced but not the result after replacement, it is very different from what sed does.
$ echo a b c | perl -w -nle 'print s/a/aa/'
will return 1
do it this way:
$ echo a b c | perl -w -nle 's/a/aa and print'
aa b c
Subscribe to:
Posts (Atom)