UUID / GUID generator

http://kruithof.xs4all.nl/uuid/uuidgen

Udgivet i Links | Skriv en kommentar

UUID / GUID generator

http://kruithof.xs4all.nl/uuid/uuidgen

Udgivet i Knowledge Base | Skriv en kommentar

Adding chroot ssh access and mounting directory multiple places

in fstab:
/home/ifka              /home/jail/home/ifka ext2       bind            0 1

or command line:
mount -o bind /home/ifka /home/jail/home/ifka

And about the jail:
http://olivier.sessink.nl/jailkit/
Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar

Recovering md RAID after a crash

ifka ~ # cat /proc/mdstat
Personalities : [raid1]
read_ahead 1024 sectors
md0 : active raid1 ide/host0/bus1/target0/lun0/part1[1]
      39061952 blocks [2/1] [_U]

unused devices: <none>
ifka ~ # mdadm /dev/md0 --manage --add /dev/hda1
mdadm: hot added /dev/hda1
ifka ~ # watch cat /proc/mdstat

Wait for rebuild to complete.
Udgivet i Knowledge Base, Old Base | Skriv en kommentar

Booting order on Ultrasparc

ok setenv boot-device disk0:0 disk2:0
boot-device =         disk0:0 disk2:0
Udgivet i Knowledge Base, Old Base | Skriv en kommentar

Byt værdier om i et array i php

<?

# Array mangeler, copyright (c) 2006 Mikkel C.M.Christensen

function moveup($array,$num)
{
        if ($num == 0)
        {
                print "Cant do that";
                return $array;
        } else
        {
                $temp=$array[$num-1];
                $array[$num-1]=$array[$num];
                $array[$num]=$temp;
                return $array;
        }
}

function movedown($array,$num)
{
        if ($num == sizeof($array)-1)
        {
                print "Cant do that either";
                return $array;
        } else
        {
                $temp=$array[$num+1];
                $array[$num+1]=$array[$num];
                $array[$num]=$temp;
                return $array;
        }
}

?>
Udgivet i Knowledge Base, Old Base, PHP | Skriv en kommentar

Adding inline images to HTML Files

<?
print "<img src='data:image/gif;base64,".base64_encode(file_get_contents("file.gif"))."'>";
?>

Works in Firefox
Udgivet i Knowledge Base, Old Base, PHP, Programmering | Skriv en kommentar

Logrotate på Gentoo

Først, insttaller logrotate:
# emerge logrotate

Derefter, rediger /etc/logrotate.conf så den passer til dine behov.

Lettere kan det ikke blive :-)
Udgivet i Knowledge Base, Linux, Old Base | Skriv en kommentar

Proftpd passive mode behind firewalls

(By BT)

I could not get my Proftpd working in passive mode, whilst it was behind a firewall.

The solution seemed to be, to tell the server that it was behind a specific firewall (the MasqueradeAddress directive), that it should accept the situation(the AllowForeignAddress directive) and that it should use a number of designated ports(the PassivePorts directive).

AllowForeignAddress     on
PassivePorts 65000 65050
MasqueradeAddress 85.82.164.70

After that I only needed to forward and allow port 65000 to 65050 to the firewall host.

It should be noted, that my server is running on port 2100 due to the fact that I have more than one FTP server in house.

The other server runs perfectly in active mode, but this one is restricted to passive mode. Probably due to the fact that m0n0wall only recognizes port 21 as FTP data traffic...
Udgivet i Knowledge Base, Old Base | Skriv en kommentar

Why i dont code C , Kernighan and Ritchie style

Page 14. "The C Programming Language" By Brian W. Kernighan and Dennis M. Ritchie  1978 a simple program to read characters from STDIN:

#define EOF -1

main()
{
        int c;

        c = getchar();
        while (c != EOF)
        {
                putchar(c);
                c = getchar();
        }
}

My logic mind prefers the following:

#define EOF -1
int main(void)
{
        int c;
        for (c=0; c!= EOF; c=getchar()) { putchar(c);}
}

Simple, logic and straightforward. Who wouldnt understand that?

 ... Now with CC-Compliance!
Udgivet i Knowledge Base | Skriv en kommentar