cheat sheets

Posted by root Fri, 30 May 2008 00:06:00 GMT

command-line cheat sheets

279 cheat sheets:
$cheat sheets
$cheat unix_text

One of Unix’s most useful features is its large number of text/data manipulations programs. Some of the more propular include:

cat - concatenate and display files
cut - remove selected fields from each line of a file
sort - sort and collate lines
uniq - remove or report adjacent duplicate lines
awk - pattern scanning and processing language
sed - stream editor
tr - translate characters
diff - display line-by-line differences between pairs of text files
grep, egrep, fgrep - search a file for a string or regular expression
paste - join corresponding lines of several files, or subsequent lines of one
file
colrm - remove characters from specified columns within each line
expand, unexpand - expand TAB characters to SPACE characters, and vice versa

Posted in  | Tags  | no comments

Distance

Posted by root Tue, 27 May 2008 12:49:00 GMT

Tags  | no comments

Convert an array to a hash

Posted by root Sun, 04 May 2008 21:56:00 GMT

class Array
  def to_h
    arr = self.dup
    if arr.size % 2 == 0
        Hash[*arr]
    else
        Hash[*arr << nil]
    end
  end
end

Posted in  | Tags  | no comments