How to create a large file quickly

To create a large file VERY quickly (without dumping data into), for example a 20GB file, do like this: dd if=/dev/zero of=mylargefile.img seek=$(( 20 *1024*1024*1024 -1 )) bs=1 count=1 This will create your file in a second without dump zeroes using the classic ‘dd’ command: dd if=/dev/zero of=mylargefile.img bs=1M count=$((20 * 1024)) Useful to create [...]

Monitoring Bea Weblogic thread pools with a Perl script

Recently i developed a Perl script for a TLC company to monitor thread pools of a weblogic cluster with nagios, here i’m going to post a sample version.

Proftpd with MySQL + MD5 users’ password on lenny

The old versions of proftpd dont support mysql md5 algorithm for password checks, so for who like me use debian lenny with 1.3.1 the only way to make it work with MD5 is to use PAM-MySQL + libnss-mysql. With 1.3.x proftpd comes with mod_sql_passwd.c that solve this problem (here a sample conf): SQLAuthTypes MD5 SQLPasswordEngine [...]

Configuring Apache dynamic virtualhosts with LDAP and mod_vhost_ldap_ng

Working for a Hosting provider we need to centralize virtualhosts configs on database, but there is not a native apache virtualhost module based on LDAP or SQL backends. We started using mod_vhost_ldap without success because our customer’s servers have weird paths for ServerRoot and vhosts positions changes between servers… moreover mod_vhost_ldap doesn’t support Alias parameter and [...]

Improved roundcube managesieve plugin

When creating a new filter in RC Managesieve plugin with the rule “Sender is equal to” RC compile a sieve script like this one: if anyof (header :is “From” “example@example.com”) { fileinto “INBOX.Spam”; stop; } Of course this script will FAIL when sender is ‘”Simone Caruso” <example@example.com>’, because “header” matches strings NOT addresses! Ref. RFC5228 [...]

PHP Database class for master/slave mysql cluster

Environment My customer, in this case an ISP,  has multiple dns servers was going to scale-out the DNS records database for multiple DNS servers. The startup configuration was a master/slave, with DRBD failover MySQL cluster; the new configuration was accomplished with a MySQL master database and three servers as slaves, two for DNS servers queries and one for [...]

A PayPal sample code with PHP Pear

Times ago, because we entered the web2.0/e-commerce generation all custemers want an e-shop, I was looking for some Pear/PayPal PHP script without success. Becouse i love pear for speeding up code development etc i wrote my little pear/paypal library, here an example.

Build dovecot 2.0.1 debian packages

I really like the apt system, i often use it for my personal binary packages distribution between my systems and it’s great to install test systems in few minutes. In august dovecot 2.0.1 was released, i’d have liked to test the new software on my lenny servers, but i could not find any .deb binary [...]

Decrypt PEM ssl certificate

Starting a secure server like Apache, Postfix, Dovecot etc needs passphrase submission at startup… so it’s a problem start these services at book. The solution is decrypting the certificate private key with the following command: openssl rsa -in priv.key -out decrypted-priv.key

Small php persistence class

A small persistence class for PHP, integrable with any kind of persistence storage (file, SQL, …)