Thursday, January 10, 2008

[Photo] Hasselblad Masters

get inspired

Hasselblad Masters
http://www.hasselbladusa.com/masters-2007.aspx


http://www.hasselbladusa.com/masters-2007/march---raya.aspx


"Believe in yourself, don't give up and have confidence, aim very high and always to want to do better. Of 30 closed doors, there will be one which will open."
-- Raya

Tuesday, January 8, 2008

[Tips] Mozilla keyboard shortcuts

Mozilla keyboard shortcuts

new Tab: Ctrl + t
close Tab: Ctrl + w
close window: Ctrl + Shift + w
switching Tab: Ctrl+PageUp(PageDown) or Alt + 1/2/3...

Thursday, December 6, 2007

[Work] sed, awk, perl

sed, awk, perl

http://www.student.northpark.edu/pemente/awk.htm


# Print the length of the longest input line:

awk '{ if (length($0) > max) max = length($0) }
END { print max }' data

# Print every line that is longer than 80 characters:

awk 'length($0) > 80' data

The sole rule has a relational expression as its pattern and it has no action—so the default action, printing the record, is used.

# Print the length of the longest line in data:

expand data | awk '{ if (x < length()) x = length() }
END { print "maximum line length is " x }'

The input is processed by the expand utility to change tabs into spaces, so the widths compared are actually the right-margin columns.
# Print every line that has at least one field:

awk 'NF > 0' data


This is an easy way to delete blank lines from a file (or rather, to create a new file similar to the old file but from which the blank lines have been removed).
# Print seven random numbers from 0 to 100, inclusive:

awk 'BEGIN { for (i = 1; i <= 7; i++)
print int(101 * rand()) }'


# Print the total number of bytes used by files:

ls -l files | awk '{ x += $5 }
END { print "total bytes: " x }'


# Print the total number of kilobytes used by files:

ls -l files | awk '{ x += $5 }
END { print "total K-bytes: " (x + 1023)/1024 }'

# Print a sorted list of the login names of all users:

awk -F: '{ print $1 }' /etc/passwd | sort

# Count the lines in a file:

awk 'END { print NR }' data

# Print the even-numbered lines in the data file:

awk 'NR % 2 == 0' data