Archive

Archive for the ‘Uncategorized’ Category

Allow ZLIB compression in CURL and PHP

August 6th, 2010 No comments

function file_get_contents_utf8($URL)
{
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_HEADER, 1);
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_URL, $URL);
curl_setopt($c, CURLOPT_HTTPHEADER, array("Accept-Encoding: gzip, deflate","Accept: */*"));
$ret = curl_exec($c);
curl_close($c);

if(strpos($ret, "\r\n\r\n")){
$add = 4;
}else{
$add = 0;
}

$m_body = substr($ret, strpos($ret, "\r\n\r\n")+$add );
$m_header = substr($ret, 0, -strlen($m_body));

if(strstr($m_header,"Content-Encoding: gzip")){
$contents = gzinflate(substr($m_body,10));
}else{
$contents = $m_body;
}

if ($contents) return $contents;
else return FALSE;
}

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: PHP, Uncategorized Tags:

Getting apache fullstatus to work

July 12th, 2010 No comments

Make sure mod_status is enabled in your httpd / apache config, and add the following lines


ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from localhost
</Location>

If you are getting permission errors, try setting

UseCanonicalName Off

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: Uncategorized Tags:

Increase shared memory Linux

April 16th, 2010 No comments

echo $((1024 * 1024 * xxx)) > /proc/sys/kernel/shmmax

Change xxx to MB required

To read value ( in MB )

echo $((`cat /proc/sys/kernel/shmmax` / 1048576))

Add command to rc.local to enter at boot.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: Uncategorized Tags:

Mac SAY voices

November 27th, 2009 No comments

Female Voices
Agnes
Kathy
Princess
Vicki
Victoria

Male Voices
Bruce
Fred
Junior
Ralph

Novelty
Albert
Bad News
Bahh
Bells
Boing
Bubbles
Cellos
Deranged
“Good News”
Hysterical ”
“Pipe Organ”
Trinoids
Whisper
Zarvox

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: Uncategorized Tags:

Unpack TAR/BZ2

November 26th, 2009 No comments

tar -jxvf filename.tar.bz2

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: Uncategorized Tags: