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.
[Snippet] Stop Windows Update irritating you to restart after updates
I've been irritated to reboot my laptop every fifteen minutes to reboot my laptop. Its never convenient is it.
Click Start, Run and type net stop wuauserv
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.
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.
#!/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;
Using SCP to copy files between Linux servers
SCP? SCP is a method of securely transferring files between a local and a remote host or between two remote hosts, using the Secure Shell (SSH) protocol.
Sounds confusing?
Permanently mount a Windows share in Linux
Sick of manually mounting a Windows share on Linux with "mount" for it to drop off randomly? Or not really knowing if it is mounted or not?
Then make a permanent mount in fstab.
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.
Install Imagemagick / Imagick for PHP on Ubuntu
No problem if you want to install imagemagick on your server, Ubuntu makes this very easy for you with only a few simple commands.
Find text within files
Stuck trying to find text within files on Linux?
cd /directory_tree_you_want_to_search
find . -type f -exec grep -l "string to find" {} \; -print
Easy!

