Older blog entries for coywolf (starting at number 15)

6 May 2009 (updated 6 May 2009 at 08:13 UTC) »

This perl script gets Week_Of_Year from string like"2009-05-06".


use POSIX;
my $date = "2009-05-06";
my @d = split "-", $date;
my $week_of_year = strftime("%W", localtime
mktime(0,0,0,$d[2],$d[1]-1,$d[0]-1900));
print $week_of_year, "\n";
5 Jun 2008 (updated 5 Jun 2008 at 07:34 UTC) »

With postfix 2.4.5, virtual_alias_domains seems not work.

In main.cf,


virtual_alias_domains = domain.tld
virtual_alias_maps = mysql:/etc/postfix/mysql-alias-maps.cf

In mysql-alias-maps.cf, use either '%s' to do a full match or '%u' with a 'domain = domain.tld'.

26 May 2008 (updated 27 May 2008 at 08:59 UTC) »

How I put a website under SVN


/etc/apache2/sites-available/foo
<VirtualHost *>
RedirectMatch 404 .*/\.svn(/|$)
</VirtualHost>


$ cd /var/
$ tar zcf /tmp/foo-src.tar.gz www-foo \
--exclude=www-foo/htdocs/photos --exclude=...
$ cd /tmp
$ newgrp www-data
$ tar zxf foo-src.tar.gz
$ exit
$ svnadmin create /srv/scm/www-foo
$ svn import www-foo file:///srv/scm/www-foo


$ cd
$ svn co file:///srv/scm/www-foo
$ cd www-foo
$ find . -name .svn | xargs tar zcf /tmp/foo-svn.tar.gz
$ cd /var/www-foo
$ tar zxf /tmp/foo-svn.tar


$ rm -rf /tmp/www-foo
$ rm /tmp/foo-src.tar.gz /tmp/foo-svn.tar.gz


$ newgrp www-data
$ umask 27
...
$ exit
17 May 2008 (updated 17 May 2008 at 16:59 UTC) »

Ubuntu 8.04

dhcp3-server 3.0.6

tftpd-hpa 0.48

nfs-kernel-server 1.1.2

# echo 'vfs.root.mountfrom="ufs:/dev/md0c"' > /srv/freebsd70-disc1/boot/loader.conf

PXE FreeBSD

dhcp3 3.0.4

/etc/dhcp3/dhcpd.conf
subnet 10.4.1.0 netmask 255.255.255.0 {
 range 10.4.1.100 10.4.1.200;
 filename "pxeboot";
 option root-path "/cdrom";
 next-server 10.4.1.1;
}

tftpd-hpa 0.42

/var/lib/tftpboot/pxeboot

nfs-user-server 2.2

/etc/exports
/cdrom 10.4.1.0/255.255.255.0
26 Dec 2005 (updated 26 Dec 2005 at 03:36 UTC) »

It is impossible to defeat an ignorant man in argument. It is impossible to defeat an ignorant *woman* especially in argument. Since you are arguing with them, they will not accept your evidence, since you will clearly be simply furthering your argument by "educating" them. The solution is to not argue.

I work on ext2resize now. http://ext2resize.sourceforge.net/

3 Aug 2005 (updated 3 Aug 2005 at 16:12 UTC) »

The night before last, I did a dd if=bioboot of=/dev/hda6 while I was playing with the OpenBSD bootloader on my home desktop. The biosboot is an exactly 512-byte boot sector, and the /dev/hda6 is vfat. No, I don't use windows. The box was shipped with windows, so there're hda1, hda5, hda6 (c:, d:, e:) exist as vfat.

I didn't realise the problem when I did the dd. I thought it was FAT partition. The first sector is boot sector, solely for booting. FAT tables are certainly not in that small area. I thought it was safe since I don't have to boot from it.

Last night I found I couldn't mount hda6, I realised I was in trouble. I may lost that file system. But I didn't have time to repair. Someone else was using my pc.

Tonight, I've reliased how severe the trouble is after some trying. I may lost that filesystem with 12G data. The kernel reports

FAT: Filesystem panic (dev hda6)
    fat_get_cluster: invalid cluster chain (i_pos 0)

The fact is that FAT uses the first sector also as a superblock. It even stores the media type on it. That explains why previous linux bootsector had to make guesses on track sector numbers. :-(

Is there any hope? In the boot sector, the 062-063(in octal), stores the backup boot sector location. So I checked that value from hda5, it's 6.

# od -t x1 hda5.b
0000000 eb fe 90 4d 53 57 49 4e 34 2e 31 00 02 20 42 00
0000020 02 00 00 00 00 f8 00 00 3f 00 ff 00 7b 3f 43 02
0000040 c5 fe 3a 01 af 13 00 00 00 00 00 00 02 00 00 00
0000060 01 00 06 00 00 00 00 00 00 00 00 00 00 00 00 00
0000100 80 00 29 04 1e 41 6e 4e 4f 20 4e 41 4d 45 20 20
0000120 20 20 46 41 54 33 32 20 20 20 00 00 00 00 00 00
0000140 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
*
0000760 00 00 00 00 00 00 00 00 00 00 00 00 00 00 55 aa
0001000

Then I restored the boot sector from the sector 6 on hda6. I assume hda5 and hda6 are of the same backup boot sector location.

dd if=/dev/hda6 of=hda6-skip6.b bs=512 count=1 skip=6

# file hda6-skip6.b
hda6-skip6.b: x86 boot sector, code offset 0xfe, OEM-ID "MSWIN4.1", sectors/cluster 32, M
edia descriptor 0xf8, heads 255, hidden sectors 58605183, sectors 38764782 (volu
mes > 32 MB) , FAT (32 bit), sectors/FAT 9471, rootdir cluster 348, reserved3 0x
800000, serial number 0x71eb915a, label: " DISK1_VOL3"

Yeah, that's it. I see a big hope.

dd if=hda6-skip6.b of=/dev/hda6

Now, it's recovered. Everything looks ok. mount runs ok, files are still there. It seems just like nothing has had happend! :-)

9 Jul 2005 (updated 9 Jul 2005 at 16:04 UTC) »

My two favourite quotes of today, by Daniel Hommel:

1) <homsn> i think violence is wrong, but sometimes it's the only way...

2) <homsn> hmm money is root of all evil

Ok, YAFFS site just added a link to my patch, http://www.aleph1.co.uk/yaffs/. I didn't announce it before, 'cause I'm not satisfied with it yet. Now it's there to save anyone else from writing the same thing. I hope I will get time to work on it later.

6 May 2005 (updated 6 May 2005 at 16:26 UTC) »

I believe no one can invent an algorithm. One just happens to hit upon it when God enlightens him. Or only God invents algorithms, we merely copy them. If you don't believe in God, just consider God as Nature if you won't deny existence.

5 May 2005 (updated 5 May 2005 at 23:05 UTC) »

LCA oom-killer v2.2.1 is near. I'll flush it out at any time probably.

6 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!