recursive search and replace with grep and sed

December 3rd, 2009

grep will do a first find and return the matched file names
xargs will pass each file name with its path to sed
and obviously sed will edit inline and replace the contents

grep -rl “oldword” ./  | xargs sed -i  ’s/oldword/newword/’

Ubuntu bootable RAID 10 how to

November 28th, 2009

how to install ubuntu server on raid 10

Provided you have 4 hard drives,

boot on any live disk
open a console

Partition your four disk all the same

Repeat these steps for your four disks,
using the appropriate devices: e.g. sda, sdb, sdc, sdd,

fdisk /dev/sda
n p 1 (and pick enough space for boot)
t 1 fd (makes the partition Linux auto array)
a 1 (makes the partition bootable)
n p 2 (and pick most of space, leave enough for swap on the next one)
t 2 fd
n p 3 (and pick the rest of space, this one will be swap)
t 3 fd
w (writes partition table and exits)
(eof repeat for sdb, sdc, sdd)

so now you’ll have /dev/sda1 /dev/sda2 and /dev/sda3
and so on for sdb sdc and sdd after doing partitioning for all the four disks,

now create the raid devices,

mdadm –create /dev/md0 –level=1 –raid-devices=4 /dev/sda1 /dev/sdb1 /dev/sdc1 /dev/sdd1
(these are all the bootable ones, will be set for /boot later, note that is array 1 )

mdadm –create /dev/md1 –level=10 –raid-devices=4 /dev/sda2 /dev/sdb2 /dev/sdc2 /dev/sdd2
(these are for /, will be set later)

mdadm –create /dev/md2 –level=10 –raid-devices=4 /dev/sda3 /dev/sdb3 /dev/sdc3 /dev/sdd3
(these are the swap)

now format the array devices
just format them,
do not ever think on putting a partition on top of an md device

mkfs.ext3 /dev/md0
mkfs.ext3 /dev/md1
mkswap /dev/md2

after that,
reboot using your install drive,
when going to partition, select manual,
it won’t see the devices,
click on manage array options and then on finish,
this is so the installer loads the array tools,
it will go back to partition dialog and will show the three devices devices now,

pick the first one, tell to use ext3 and mountpoint /boot
pick the second one, tell to use ext3 and mountpoint /
pick the third one, use as swap

note that you don’t need to format, because you already did.
and if you try formatting it will confuse the installer.

ok with the warnings and it will install like nothing happended
will boot from /dev/md0 which is an array 1 without problems,
and will use the rest of the system as array10

Stimulus money, again.

November 24th, 2009

Stimulus money.

Big and complex. If easy, it wouldn’t be such a drag nor material for intense debate.
Some abstractions can be made to see it simply and get at least a bit from it. Figure this: Bank lends to Person. Person cannot pay. Person loses house. Bank loses money. Bank can go kaput. Government gives people tax money to dumb Bank. Bank’s saved. Person’s not. How lame. That without considering the government overhead that implies giving money to the bank. What if the government just lends the money to Person? A win-win probably?

shell vim and screen pair programming

November 23rd, 2009

allow screen to support sharing
#>sudo chmod u+s /usr/bin/screen
#>sudo chmod 755 /var/run/screen

set a guest user account in the host machine

screen -S pair
Ctrl-a :multiuser on
Ctrl-a :acladd guest
vim

the remote user logs in as guest

ssh guest@your_accessible_ip
screen -x local_user/pair  (where local_user is your local account running screen)

to blog or not to blog

November 23rd, 2009

It’s mainly due to uncle Bob Martin’s twit on how lame we as a society become in terms of not speaking our minds due to unreasonable extreme politeness that I decided  stop procrastinating and write.

It is said we shouldn’t be talking or writing about politics, religion, abortion, drug legalization, gender changing, or other society sensible issue  if you want to keep friends.

When it comes to opinionated Ruby programming code bloging is more complicated. My friends and I can become quite judgmental and hurt mutual feelings, but friends are mine to keep as I love them and they probably do back.

I stand as a democrat but when it comes to guns, abortion and economy I divert from some of the core values.

In other venue of things I am not a mac nor a PC, but a Linux, with Ubuntu as my preferred distro. And btw, a vim rather than an emacs.
That said, Write on!

Keep tuned for more coming soon.

August 26th, 2009

Hello this is before

card

after

It takes $700Bn to learn what not to do with $700Bn

October 7th, 2008

The bailout money buys from troubled financial companies bad assets that no one in its sane mind would buy. This is a survival ticket for the companies in bad shape. But when the worries are about credit, there is no way to guaranty that credit will exist because of saving the bad companies.

In a nutshell, the banks go like “thanks for buying this crap from me, I am not broken now. But I will be cautious about lending, and I won’t to those with poor credit”.

So, what are we solving, the bank bankruptcies or the credit chain? Yes, the first option only.

The right use of bailout money would be let the banks sink, and ensure that a pool of money exists to finance home buyers.

Got Openmoko Neo-Freerunner!

July 4th, 2008

A great linux device, and the envy of those brickable iphones from the fruit brand.

http://us.direct.openmoko.com

Gl is booting up

June 3rd, 2008

Hi,

After some time looking for the right moment, and after suffering several week-ends with bad weather, I finally finished fixing my bike, it boots-up (geeky talk for starts) fine, and all is good.

There’s a valve making some noise at high revs and with the engine pushing, but that’s for next winter.

All parts are in,

March 11th, 2008

But still waiting for good weather on Sunday, last two snowed.

Great sites to buy Honda parts from where I got bolts and some missing rubber items.

Cresceentmooncycles.com -> rubber
Ronayers.com -> rubber
m-and-d.com -> bolts

let’s see how this next weekend goes,