Quantcast
Channel: Anton Titov's blog
Browsing all 11 articles
Browse latest View live

How to change maximum sync speed of linux software raid

After few unsuccesfull google searches about changing linux software raid sync speed (while waiting for idle CentOS to sync 3×200Gb SATA raid1) I decided to run: ffind /proc/ -name \*raid\* which lead...

View Article



How to force setuid program to make core dump

If you want to debug why your C/C++ application segfaults once in a while (daemon that segfaults once in few days) under Linux the obvious way is to tell your program to create core dump files on...

View Article

How to make site screenshots with linux server

Ever wanted to be able to create site screenshots, just like alexa? Want to do it on your server with a script? Than read this article. The idea is simple: install xvnc on your server, so you’ll have...

View Article

Using O_LARGEFILE or O_DIRECT on Linux

Today after some backups, generated from my C program generated few files exactly 2Gb in size I’ve remembered that there was some parameter to open for working with large files. I’ve opened man page...

View Article

How to restore reiserfs partition from crashed disk

Few days ago, a server of mine had all of it’s 4 disk crashed. The problem was that one of the disks was overheating and that seemed to help other harddrives to crash (don’t buy Maxtor). So, if you...

View Article


PHP forms spam

There are many forms on the web, that use PHP mail() function to send mail, most of the time to the site owner. The problem with this is that many of them do not verify submitted data and can be used...

View Article

How to check if a hostname is a valid registered nameserver

If you need to check for instance if “ns1.titov.net” is a registered nameserver and can be filled as nameserver for a domain you can do it this way: ask which nameservers are authoritative for zone...

View Article

“Do not use ORDER BY RAND()” or “How to get random rows from table?”

Quite often people use queries like: SELECT quote FROM quotes ORDER BY RAND() LIMIT 1 to get a random row (rows) from a table. That’s quite bad idea. For big tables, if your table have just 50-100...

View Article


Front page extensions without mod_frontpage

If you have apache server on linux and want to be able to activate front page extensions for virtual hosts but do not want to install mod_frontpage, than you can download this file...

View Article


Date and time addition and substraction

Real life example: SELECT username FROM users WHERE (ADDDATE( last_in_chat, INTERVAL 2 MINUTE) > NOW()) ORDER BY username LIMIT 30 NEVER do that. The user in question runs this query on table with...

View Article

Traffic accounting and IP restrictions on linux bridge

These days I’ve implemeted a Linux bridge that does traffic accounting and IP restrictions per mac adress and decided to share my experience. In my setup on eth0 is my gateway and on eth1 is switch...

View Article
Browsing all 11 articles
Browse latest View live




Latest Images