Thursday, March 22, 2007

pg_autovacuum usage

this is how i use autovacuum.
pg_autovacuum -v 3 -V 0.001 -a 2 -A 0.01 -U user password -d 3 -s 100

usage: pg_autovacuum
[-D] Daemonize (Detach from tty and run in the background)
[-d] debug (debug level=0,1,2,3; default=0)
[-s] sleep base value (default=300)
[-S] sleep scaling factor (default=2.000000)
[-v] vacuum base threshold (default=1000)
[-V] vacuum scaling factor (default=2.000000)
[-a] analyze base threshold (default=500)
[-A] analyze scaling factor (default=1.000000)
[-L] logfile (default=none)
[-c] vacuum_cost_delay (default=none)
[-C] vacuum_cost_page_hit (default=none)
[-m] vacuum_cost_page_miss (default=none)
[-n] vacuum_cost_page_dirty (default=none)
[-l] vacuum_cost_limit (default=none)
[-U] username (libpq default)
[-P] password (libpq default)
[-H] host (libpq default)
[-p] port (libpq default)

Saturday, March 17, 2007

http(s) over ssh tunnelling

if machine A stands in DMZ(before the firewall) and B is part of the corporate network (behind the firewall),
on the machine A :
# ssh -gNL 33333:B:443 root@B
for example:
# ssh -gNL 33333:192.168.1.119:443 root@192.168.1.119
-g - Allows remote hosts to connect to local forwarded ports.
this will cause https://A:33333/ to work just like https://B:33333/ but from outside the network.

Monday, February 12, 2007

remove accents from strings using postgresql

function remove_accents(&$str)
{
return svq("select convert(TO_ASCII(convert('".pg_escape_string($str)."','UNICODE','LATIN 1'),'LATIN 1'),'LATIN 1','UNICODE');");
}

Thursday, February 8, 2007

lighttpd canonical hosts (non-www to www redirect)

This will redirect http://domin.com to http://www.domain.com/ with 301 code

$HTTP["host"] == "domain.com" {
url.redirect = ( "^/(.*)" => "http://www.domain.com/$1" )
}

pure ftp with postgres

in the conf file words User, Password, Dir must be enclosed in "" coz its special words

starting:
pure-ftpd-postgresql -l pgsql:/etc/pure-ftpd/db/postgresql.conf -A &

Friday, February 2, 2007

install emacs on debian

aptitude install emacs-common
aptitude install emacs21

search for module to emable php-mode:
apt-cache search emacs | grep php
php-elisp - Emacs support for php files

apt-get install php-elisp

W: There are no public key available for the following key IDs

If you just ran apt-get update and you got:

There are no public key available for the following key IDs:
A70DAF536070D3A1

then type:

sudo gpg --recv-key --keyserver wwwkeys.eu.pgp.net A70DAF536070D3A1
sudo gpg --export A70DAF536070D3A1 | apt-key add -

and all will be well.