Category / Linux

Nii, stabikas läinud! February 11, 2010 at 11:35 am

Kunagi, üks kuulus isik ütles sõnad “Stabilisaator on stabiliseerimiseks”

Mäluboss January 29, 2010 at 5:54 pm

Paljud teist on ehk palju suuremate numbritega harjunud. Aga vabandage minu ülevoolavat emotsiooni :)

Hello World in different languages and speed January 25, 2010 at 4:27 pm

Assembler


.section .data
string:
.ascii "Hello world %d \n\0";

.section .text
.globl _start
_start:
movl %esp, %ebp
subl $4, %esp

movl $10000, %eax
movl $0, %ebx

loop:
cmpl $0, %eax
je loop_end
subl $1, %eax
pushl %eax
pushl $string
call printf
addl $4, %esp
popl %eax
jmp loop

loop_end:

movl $1, %eax

movl $0, %ebx

int $0x80

real 0m0.424s
user 0m0.004s
sys 0m0.254s

PHP


$i = 0;
while ($i < 10000) {
echo "Hello world\n";
$i++;

real 0m0.969s
user 0m0.034s
sys 0m0.219s
}
?>

Perl

for ($count=0; $count<10000; $count++) {
print "Hello World\n";
}

real 0m0.547s
user 0m0.014s
sys 0m0.267s

Python

#!/usr/bin/python
# Filename: hello.py

for i in range(0, 10000):
print "Hello, World!"
else:
print 'The for loop is over'

real 0m0.503s
user 0m0.018s
sys 0m0.273s

Some useful MySql sentences January 15, 2010 at 10:08 am

It is annoying to type them from the scratch every time. So a little copy paste place for my. Lazy me!

UPDATE `mysql`.`user` SET `Create_priv` = ‘Y’,
`Drop_priv` = ‘Y’,
`Reload_priv` = ‘Y’,
`Shutdown_priv` = ‘Y’,
`Process_priv` = ‘Y’,
`File_priv` = ‘Y’,
`Grant_priv` = ‘Y’,
`References_priv` = ‘Y’,
`Index_priv` = ‘Y’,
`Alter_priv` = ‘Y’,
`Show_db_priv` = ‘Y’,
`Super_priv` = ‘Y’,
`Create_tmp_table_priv` = ‘Y’,
`Lock_tables_priv` = ‘Y’,
`Execute_priv` = ‘Y’,
`Repl_slave_priv` = ‘Y’,
`Repl_client_priv` = ‘Y’,
`Create_view_priv` = ‘Y’,
`Show_view_priv` = ‘Y’,
`Create_routine_priv` = ‘Y’,
`Alter_routine_priv` = ‘Y’,
`Create_user_priv` = ‘Y’ WHERE CONVERT( `user`.`Host` USING utf8 ) = ‘h3.okia.ee’ AND CONVERT( `user`.`User` USING utf8 ) = ‘root’ LIMIT 1 ;

Ull ütles et oleme valmis täpitama December 18, 2009 at 2:34 pm

ull
tegime just ühe ä tähtedega domeeni ispmaniga
2:31 www.snäp.eu
2:31 selle asjaga tuleb nimi ära konvertida: http://mct.verisign-grs.com/
2:32 ja siis konvertidu kujul saab teha domeene ja asju ispmanis ja kõik töötab

VIM + SVN December 4, 2009 at 2:52 pm

Screen shot 2009-12-04 at 2.50.30 PM

cifs ja apache November 26, 2009 at 3:42 pm

Selline lugu juhtus täna.

Tahtsin ühte NAS serveri sharet mis oli mounditud cifs võtmega, apache kaudu serveerida. Asi nagu peaaegu õnnestus. Faile sai näha ja puha. Aga kui hakkata alla laadima siis tuleb 0 biti.

TCP liikluse analüüs ka targemat miskit ei andnud:


GET /path/to/file HTTP/1.1
User-Agent: Opera/9.80 (Macintosh; Intel Mac OS X; U; en) Presto/2.2.15 Version/10.10
Host: ftp.example.com
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept-Language: en,ja;q=0.9,fr;q=0.8,de;q=0.7,es;q=0.6,it;q=0.5,pt;q=0.4,pt-PT;q=0.3,nl;q=0.2,sv;q=0.1,nb;q=0.1,da;q=0.1,fi;q=0.1,ru;q=0.1,pl;q=0.1,zh-CN;q=0.1,zh-TW;q=0.1,ko;q=0.1
Accept-Charset: iso-8859-1, utf-8, utf-16, *;q=0.1
Accept-Encoding: deflate, gzip, x-gzip, identity, *;q=0
Authorization: Basic dGFua2NsaWVudDpNaW5nZVRhbmtpMDAxsad3
Connection: Keep-Alive, TE
TE: deflate, gzip, chunked, identity, trailers

HTTP/1.1 200 OK
Date: Thu, 26 Nov 2009 11:33:48 GMT
Server: Apache
Last-Modified: Thu, 21 May 2009 12:37:30 GMT
ETag: "3830e7-f19ac-46a6b68415680"
Accept-Ranges: bytes
Content-Length: 989612
Keep-Alive: timeout=10, max=5
Connection: Keep-Alive
Content-Type: text/plain

Kogu moos.

siis selgus et see on vana hea tundud probleem ja lahenduse annab apache virtuali konfis: EnableSendfile Off

Some xen guest creating hints November 23, 2009 at 11:50 pm

lvcreate -L 500M -n vm22.swap vg

lvcreate -L 10G -n vm22.root vg

lvcreate -L 20G -n vm22.var vg

mkfs.ext3 /dev/vg/vm22.root

mkfs.ext3 /dev/vg/vm22.var

mkswap /dev/vg/vm22.swap

mkdir /mnt/var

mkdir /mnt/proc

mkdir /mnt/sys

mount /dev/vg/vm22.root /mnt/

mount /dev/vg/vm22.var /mnt/var

cd /mnt/

tar -zxvf /root/f11-x86_64-base.tar.gz

rm f11-x86_64-base.tar.gz

vim ./etc/sysconfig/network

vim ./etc/sysconfig/network-scripts/ifcfg-eth0

vim ./etc/fstab

vim ./etc/sysconfig/network-scripts/ifcfg-eth0:1

vim ./etc/hosts

umount /mnt/var/

cd /

umount /mnt/

cd /etc/xen/auto/

cp vm21 vm22

vim vm22

xm create -c /etc/xen/auto/vm22

Apache seadete olulisus November 18, 2009 at 3:18 pm

Allpool on näha ühe serveri mälukasutuse graafik. Kuni punase jooneni kadus vaba mälu mis ei ole linux kerneli puhul midagi erilist, pigem hea. Samas on näha et ei cachetud mälu mis on aga väga halb.
Kuni punase kriipsuni olid apache seaded default. Peale seda seadistasin apache serverit ning peale punast kriipsu on ka tulemus. Minu arust päris hea.

arendus_mem

How to clear cache memory November 16, 2009 at 10:57 pm

Sometimes it is good to know it :)

sync; echo 3 > /proc/sys/vm/drop_caches