Installing memcached on CentOS (cPanel)

Welcome to hell. No really, compared to installing memcached on Ubuntu, CentOSs really sucks. CentOS really sucks for package management.  Really sucks. Anyway, on to the point.

Here’s how I installed memcached on CentOS, which I mainly use for cPanel. Continue reading “Installing memcached on CentOS (cPanel)”

Simple install of memcached on Ubuntu

Memcached is a free, high performance distributed memory object caching system. In English, it can make your single server PHP applications faster or for a little more technical users you can write cache and share cache objects over a web server farm or cluster. Great, eh.

No seriously, it can really make your PHP faster. Continue reading “Simple install of memcached on Ubuntu”

Insert Coin

Bored at work? This script connects to a JetDirect equipped HP printer and uses HP’s control language to set the ready message on the LCD display. Takes an IP address and message on the command line. My favorite message is “INSERT COIN”.

Keep in mind the limitations of the display when composing your clever verbiage.

insert_coin

#!/usr/bin/perl
# $Id: hpsetdisp.pl 11 2006-03-22 01:21:03Z yaakov $

# hpsetdisp.pl

use strict;
use warnings;

unless (@ARGV) { print “usage: $0 \”\”\n” ; exit }
if ($ARGV[3]) { print “Did you forget the quotes around your clever
message?\n” ; exit }

my $peeraddr = $ARGV[0];
my $rdymsg = $ARGV[1];
chomp $peeraddr;

use IO::Socket;
my $socket = IO::Socket::INET->new(
PeerAddr => $peeraddr,
PeerPort => “9100”,
Proto => “tcp”,
Type => SOCK_STREAM
) or die “Could not create socket: $!”;

my $data = <
\e%-12345X\@PJL JOB
\@PJL RDYMSG DISPLAY=”$rdymsg”
\@PJL EOJ
\e%-12345X
EOJ
;

print $socket $data;


Block Countries in Apache

Assuming you have mod_geoip installed in apache we can block certain countries in 6 lines of code.

I had a client who was experiencing an inhumane amount of spam on their phpBB forums, which are notorious for bot attacks. Luckily this forum was geographically specific – so we can block all the countries we aren’t interested in.

Continue reading “Block Countries in Apache”