jump to navigation

vim search and replace 03.13.06

Posted by wimac in computing.
add a comment

Just a vim tip I felt like passing along…

:help :s

:[range]s[ubstitute]/{pattern}/{string}/[&][c][e][g][p][r][i][I] [count]

    For each line in [range] replace a match of {pattern} with {string}.
    {string} can be a literal string, or something special; see ¦sub-replace-special¦.
    When [range] and [count] are omitted, replace in the current line only.
    When [count] is given, replace in [count] lines, starting with the last line in [range]. When [range] is omitted start in the current line.
    Also see ¦cmdline-ranges¦.
    See ¦:s_flags¦ for the flags.

:%s/s->/t->/g<CR>

In command mode (where <CR> is your return key)

Be aware of patterns (:help pattern)

I have a map in my .vimrc like this:

map gs :%s

Because :%s is so hard to type. To substitute globally you would, in command mode, do gs/foo/bar/g<CR>

RIM Settles 03.04.06

Posted by wimac in computing.
add a comment

CrackBerry users will not have to face the pains of messaging withdrawal thanks to a $613m settlement between Research in Motion (RIM) and NTP.

RIM paid up to settle all patent infringement claims made by NTP. In addition, it has acquired a perpetual license for NTP’s IP. Blackberry users everywhere will rejoice as it appeared RIM might have to shut down its messaging service as part of the ongoing dispute with NTP.

RIM puts $613m settlement in motion | The Register:

Funny Unix csh/sh commands: 03.02.06

Posted by wimac in *nix, computing.
add a comment

% cat “food in cans”
cat: can’t open food in cans

% nice man woman
No manual entry for woman.

% rm God
rm: God nonexistent

% ar t God
ar: God does not exist

% ar r God
ar: creating God

% “How would you rate Quayle’s incompetence?
Unmatched “.

% Unmatched “.
Unmatched “.

% [Where is Jimmy Hoffa?
Missing ].

% ^How did the sex change operation go?^
Modifier failed.

% If I had a ( for every $ the Congress spent, what would I have?
Too many (’s.

% make love
Make: Don’t know how to make love. Stop.

% sleep with me
bad character

% got a light?
No match.

% man: why did you get a divorce?
man:: Too many arguments.

% !:say, what is saccharine?
Bad substitute.

% %blow
%blow: No such job.

% \(-
(-: Command not found.

$ PATH=pretending! /usr/ucb/which sense
no sense in pretending!

$ drink matter
matter: cannot create

Data center for the paranoid 03.02.06

Posted by wimac in computing.
add a comment

England. It is an impregnable fortress 30 meters below ground. It has three meter think concrete walls, steel doors weighing over two tons, 24-hour watch, guard dogs and CCTV. It offers protection from attacks including crackers, terrorists, electro-magnetic pulse, electronic eavesdropping, HERF weapons and solar flares.

read more

Torrent Sites Under Attack 02.24.06

Posted by wimac in computing.
add a comment

The MPAA filed lawsuits against Torrentspy, Isohunt, Torrentbox, Niteshadow and Bthub. This could have a huge impact on the Bittorrent community since Torrentspy and Isohunt are two of the most frequently visited torrent sites.

read more | digg story

Chrooted SSH HowTo 02.04.06

Posted by wimac in *nix, computing.
add a comment

This tutorial describes how to install and configure OpenSSH so that it will allow chrooted sessions for users. With this setup, you can give your users shell access without having to fear that they can see your whole system. Your users will be jailed in a specific directory which they will not be able to break out of.

read more | digg story