Archive for March, 2008

Paris by night 91 – full !

Part 1 :

Part 2 :

Part 3 :

Part 4 :

Part 5 :

Part 6 :

Part 7 :

<

Part 8 :

Part 9 :

Part 10:

Part 11 :

Part 12 :

Part 13 :

Part 14 :

Part 15 :

Part 16 :

Comments (1)

Bash command : Read the content a file !

A simple bash command to read line from a file :

cat |while read line; do echo “${line}”; done

Leave a Comment

English song !

Love to be loved :

Leave a Comment

Asian Idol 2007 !

Part 1 :

Leave a Comment

Reu phong !

Leave a Comment

Phuong Vy – Vietnam Idol 2007 !

Luc moi yeu :

Leave a Comment

My comic collection !

Moi download duoc tu trang comic.vuilen.com, up len cho moi nguoi cung doc :D

Ao giap vang : http://www.megaupload.com/?d=3TELQ7CP
http://www.megaupload.com/?d=31NTOTHP
http://www.megaupload.com/?d=ACW2OLWD

Cau be vo song : http://www.megaupload.com/?d=KP24NYK2
http://www.megaupload.com/?d=FS4I8UDP
http://www.megaupload.com/?d=DZ59U9VC
http://www.megaupload.com/?d=5QI772G6
http://www.megaupload.com/?d=BHVQFBVQ
http://www.megaupload.com/?d=I9CX5D0R

Chu be rong : http://www.megaupload.com/?d=3S1TX2NX
http://www.megaupload.com/?d=G65OIXLE
http://www.megaupload.com/?d=DUADAJ4H
http://www.megaupload.com/?d=H6FCNNZD

Dragon ball : http://www.megaupload.com/?d=J0568RRE
http://www.megaupload.com/?d=97BIIQY0
http://www.megaupload.com/?d=YG2FFH5D
http://www.megaupload.com/?d=CGEKDZ2Q

Doremon : http://www.megaupload.com/?d=ETZFZ6E3
http://www.megaupload.com/?d=6HOOP033
http://www.megaupload.com/?d=R3JKLKHG
http://www.megaupload.com/?d=YEBXWW1L
http://www.megaupload.com/?d=L9LGXJ74

Doremon them : http://www.megaupload.com/?d=UEOU5PYC

Hiep khach giang ho : http://www.megaupload.com/?d=3HRDYZO0
http://www.megaupload.com/?d=5C10H71N
http://www.megaupload.com/?d=0T3A4FSI
http://www.megaupload.com/?d=9OT9TUE4

Inu-Yasha : http://www.megaupload.com/?d=D8D7KBV2
http://www.megaupload.com/?d=R6N1XS4D
http://www.megaupload.com/?d=DMQTUUI5
http://www.megaupload.com/?d=WKP6DRW0

Ket gioi su : http://www.megaupload.com/?d=0YQBYGZ0
http://www.megaupload.com/?d=LU93RYNM

Ki thu co vay : http://www.megaupload.com/?d=Y3FB0SWG
http://www.megaupload.com/?d=NMI1TEGM
http://www.megaupload.com/?d=Z7SYLH3I

Conan : http://www.megaupload.com/?d=7HORJ9FP
http://www.megaupload.com/?d=FTGLMLSR
http://www.megaupload.com/?d=0UCAVD2V
http://www.megaupload.com/?d=SDHO9YYD
http://www.megaupload.com/?d=37AUFSZ3
http://www.megaupload.com/?d=VK5NABP0
http://www.megaupload.com/?d=4OX7DTFY

Naruto : http://www.megaupload.com/?d=RERKZFRX
http://www.megaupload.com/?d=GZT3ZBS2
http://www.megaupload.com/?d=639AVEM5

Jindo : http://www.megaupload.com/?d=3NUTIPU7
http://www.megaupload.com/?d=GP0BEDH9
http://www.megaupload.com/?d=NV6T6DD9
http://www.megaupload.com/?d=VZPO0IW7
http://www.megaupload.com/?d=H4AEQM1Q
http://www.megaupload.com/?d=UBICQRTL
http://www.megaupload.com/?d=H1K6DZZ8
http://www.megaupload.com/?d=OXYH9IQ0

Tieu dau bep cung dinh :
http://www.megaupload.com/?d=98BW7WVZ
http://www.megaupload.com/?d=A9I79BM0

Hoi phap su : http://www.megaupload.com/?d=FUR4FZK3

Jindo-dinho : http://www.megaupload.com/?d=2TILT5ZQ
http://www.megaupload.com/?d=TL5OK9R0
http://www.megaupload.com/?d=R4MTWQL6
http://www.megaupload.com/?d=LTQPI1VU
http://www.megaupload.com/?d=08WS2V3M
http://www.megaupload.com/?d=DW4EH4XO

Long phi bat bai : http://www.megaupload.com/?d=PMODNLPD
http://www.megaupload.com/?d=WL9JZIMR
http://www.megaupload.com/?d=NEC7W4Q6

Leave a Comment

Bash script to connect to strongest unencrypted wifi AP

#!/bin/bash# Finds the strongest unencrypted AP and tries to connect to it via dhcp# Call this script like "wifi.sh wlan0"TEMP=/tmp/bestap.tmpLOCK=/var/lock/bestap.lockif [ `whoami` != "root" ];then       echo "Sorry, you need to be root to run this program"       exit 1fi

if [[ -z $1 ]];then       echo "USAGE: $0 device"       exit 1else       interface=$1fi

# Checking for lockif [[ -e $LOCK ]];then       exit 1; # Too simply nothing to do here :) else       touch $TEMP $LOCKfi

isNotInteger(){   x=$1   case $x in       *[!0-9])           return 0 ;;       *)           return 1 ;;   esac}

# Proggyiwlist $interface scan > $TEMPNumAPs=`cat $TEMP | grep ESSID | wc -l`BestAP=0BestQuality=-1for i in `seq 1 $NumAPs`;do  # Check if AP is encrypted  Encryption=`cat $TEMP | grep Encryption | head -n$i | tail -n1 | cut -d":" -f2`  if [ $Encryption = "off" ]; then     # Find AP with the highest quality     QUALITY=`cat $TEMP | grep Quality | head -n$i | tail -n1 | cut -d":" -f2 | cut -d"/" -f1 | sed 's/ //g'`     if isNotInteger "$QUALITY"; then       # If we didn't find an integer, try this instead:       QUALITY=`cat $TEMP | grep Quality | head -n$i | tail -n1 | cut -d"=" -f2 | cut -d"/" -f1 | sed 's/ //g'`     fi     if [ "$QUALITY" -gt "$BestQuality" ]; then        BestQuality=$QUALITY        BestAP=$i     fi  fidoneif [ $BestAP -gt 0 ]; then  # Yay, we found an unencrypted AP:  echo Connecting to...  ESSID=`cat $TEMP | grep ESSID | head -n$BestAP | tail -n1 | cut -d""" -f2`  echo ESSID=$ESSID  MODE=`cat $TEMP | grep Mode | head -n$BestAP | tail -n1 | cut -d":" -f2`  echo Mode=$MODE  CHANNEL=`cat $TEMP | grep Channel | head -n$BestAP | tail -n1 | cut -d"(" -f2 | sed 's/Channel //g' | sed 's/)//g'`  echo Channel=$CHANNEL  # Connect  iwconfig $interface essid $ESSID mode $MODE channel $CHANNEL  if [ -e /etc/dhcpc/dhcpcd-${interface}.pid ]; then     rm /etc/dhcpc/dhcpcd-${interface}.pid  fi  dhcpcd $interface  # Cleanupfirm -f $TEMP $LOCK

Leave a Comment

Rename multiple file !

We are going to use rename which is a perl script, and also the know mv, together with for, in “one-line” shell-script

rename

Syntax

rename [ -v ] [ -n ] [ -f ] perlexpr [ files ]

-v
Verbose: print names of files successfully renamed.
-n
No Action: show what files would have been renamed.
-f
Force: overwrite existing files.
perlexpr Perl Expression

Regular Expressions

^
matches the beginning of the line
$
matches the end of the line
.
Matches any single character
(character)*
match arbitrarily many occurences of (character)
(character)?
Match 0 or 1 instance of (character)
[abcdef]
Match any character enclosed in [] (in this instance, a b c d e or f)
ranges of characters such as [a-z] are permitted. The behaviour
of this deserves more description. See the page on grep
for more details about the syntax of lists.
[^abcdef]
Match any character NOT enclosed in [] (in this instance, any character other than a b c d e or f)
(character)\{m,n\}
Match m-n repetitions of (character)
(character)\{m,\}
Match m or more repetitions of (character)
(character)\{,n\}
Match n or less (possibly 0) repetitions of (character)
(character)\{n\}
Match exactly n repetitions of (character)
\(expression\)
Group operator.
\n
Backreference – matches nth group
expression1\|expression2
Matches expression1 or expression 2. Works with GNU sed, but this feature might not work with other forms of sed.
\w
matches any single character classified as a “word” character (alphanumeric or “_”)
\W
matches any non-“word” character
\s
matches any whitespace character (space, tab, newline)
\S
matches any non-whitespace character
\d
matches any digit character, equiv. to [0-9]
\D
matches any non-digit character

As rename is a perl cript you will need perl to run it, and here are some examples about how to use it.

$ rename -v ’s/\.htm$/\.html/’ *.htm

This is going to change htm to html in every file ending with .htm in its name.

If you want to change the name of something like this:

-rw-r--r-- 1 ggarron ggarron 0 2007-12-30 19:33 1.txt-rw-r--r-- 1 ggarron ggarron 0 2007-12-30 19:33 2.txt-rw-r--r-- 1 ggarron ggarron 0 2007-12-30 19:34 3.txt-rw-r--r-- 1 ggarron ggarron 0 2007-12-28 20:35 b.txt-rw-r--r-- 1 ggarron ggarron 0 2007-12-28 20:35 c.txt-rw-r--r-- 1 ggarron ggarron 0 2007-12-28 20:35 d.txt-rw-r--r-- 1 ggarron ggarron 0 2007-12-28 20:35 e.txt

That is the output of ls -l, and are files created with touch by me for this examples.

nNow lets say I want to add a more descriptive string to the name of these files like Thesis, so here we go.

rename -n ’s/(\w{1})\.txt$/$1_thesis\.txt/’ *.txt

Note: I am using -n to make only a test and see if the result is what I want

1.txt renamed as 1_thesis.txt2.txt renamed as 2_thesis.txt3.txt renamed as 3_thesis.txtb.txt renamed as b_thesis.txtc.txt renamed as c_thesis.txtd.txt renamed as d_thesis.txte.txt renamed as e_thesis.txt

As you see that is what I wanted, now lets suppose I only want to change the name to files with a number in the name and with a letter in it.

rename -n ’s/(\d{1})\.txt$/$1_thesis\.txt/’ *.txt

1.txt renamed as 1_thesis.txt2.txt renamed as 2_thesis.txt3.txt renamed as 3_thesis.txt

You can also match only the ones with non-digit names

rename -n ’s/(\D{1})\.txt$/$1_thesis\.txt/’ *.txt

And the output will be:

b.txt renamed as b_thesis.txtc.txt renamed as c_thesis.txtd.txt renamed as d_thesis.txte.txt renamed as e_thesis.txt

As you may see, it is just a “using the right regexp” thing.

In case you do not have rename on your system (I think non-Debian does not have) you can use mv

Using mv

Introduction

Here we will first need to learn something about bash string operators

Match and substitute, there are two basic forms for this, substitute from the right of the match and from the left of the match.

substitution from the right

${var%t*string}

Now if we want to erase the word thesis from the previous example just enter:

for i in *.txt; do mv “$i” “${i%t*.txt}.txt”; done

Before:

-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 1_thesis.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 2_thesis.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 3_thesis.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 b_thesis.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 c_thesis.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 d_thesis.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 e_thesis.txt

After:

-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 1_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 2_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 3_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 b_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 c_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 d_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:24 e_.txt

substitution from the left

${var#string}

And if we want to replace .txt for .txt.bak just enter:

Now lets suppose we have this:

-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 thesis-1_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 thesis-2_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 thesis-3_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 thesis-b_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 thesis-c_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 thesis-e_.txt

And we want to erase the word thesis

Just enter this:

for f in thesis*; do mv “$f” “${f#thesis-}”; done

And the output of ls -l will now be:

-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 1_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 2_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 3_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 b_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 c_.txt-rw-r--r-- 1 ggarron ggarron    0 2007-12-30 20:28 e_.txt

My example :   I have a lot of files named Untitled-xxx.jpg. Now I want to rename to xxx.jpg   I must use the syntaxe : rename 's/^Untitled-//g ; s/^0+//g' *.jpg

Leave a Comment

Nàng Công Chúa Cổ Tích – Phan Đinh Tùng !

Bài Hát: Nàng Công Chúa Cổ Tích ∞ Trình Bày: Phan Đinh Tùng ∞ Sáng Tác: Phan Đinh Tùng

Anh mơ ước đến một ngày nào đó
Được nhìn thấy thấy nụ cười
Thấy một người như anh ước mơ
Đông nay với gió lúa về lạnh quá
Anh vẫn đứng dưới hiên nhà
Với nguyện cầu được trông thấy em
Rồi em đến
Làm mùa xuân đến mau
Mang nắng ấm về
Và từ đây giấc mơ
Tình bay cao

ĐK:
Người ơi, có biết
Thế giới chúng ta quá bao la với những ước mơ
Nhưng mình anh ước rằng giờ suốt đời
Bước cùng bên em thôi
Gió mãi hát khúc ca để đôi mình mãi mãi thiết tha
Anh sẽ luôn tin rằng
Nàng công chúa bên anh trọn đời

Xưa anh rất thích câu chuyện cổ tích
Cô tiên bé xíu hiện về để chuyện trò cùng anh suốt đêm
Cô tiên nói đến một ngày nào đó
Khi con mãi nhớ nụ cười, nhớ một người là con đã yêu

Leave a Comment

Older Posts »