I had a text file with multiple lines of input that I was manipulating using awk and sed but I found the following ‘tr’ command easiest to remove the line breaks: cat input.txt | tr -d ‘\n’
Posts By: jonny
Apache Protect Multiple Locations
The configuration directive below is one I used to protect multiple URLs with a htpasswd file. So match (~) /url01/ or (|) /url02/ or (|) …. <Location ~ “/url01/|/url02/|/rfinlay1/|/cgribb5/|/lgrw01/|/ahll7/|/cki3/|/ele02/|/mm24/|/cmcc78/|/jmc8/|/gmc1/|/mmy82/|/eoa1/|/cs01/|/pr5/|/ln50/|/rc1/|/hd01/|/a05/|/e1/|/ss12/|/mm6/|/s75/|/gp01/” > AuthUserFile /etc/httpd/conf/.htpasswd-file AuthName “Restricted Access” AuthType Basic Require valid-user </Location>
BIND on CentOS 5
The version of Bind in the normal Red Hat / CentOS repositories is a little out of date. To get more up-to-date versions (9.7.4 at the time of writing) use the Centalt and EPEL repositories. Create the following file: vi /etc/yum.repos.d/centalt.repo And add the following to it: [CentALT] name=CentALT Packages for Enterprise Linux 5 –… Read more »
USB Multiboot Drive
This tool from pendrivelinux.com is a useful utility to help create a bootable USB pen drive with a menu system for booting into multiple operating systems. It works from within Linux/Ubuntu although there is a Windows tool available too. Useful for creating Live CDs for partitioning, virus checking, installing and includes persistent storage.
jQuery Reading Shakespeare XML
I was helping someone with some jQuery to read XML files of Shakespeare plays and this is what I came up with. Very incomplete but he so I can reference it in future…. shaXpeare shaXpeare The plays of Shakespeare with added X Factor Home Contents Play Choose a Play: Choose a PlayTRAGEDIESAntony and CleopatraCoriolanusHamletJulius CaesarKing… Read more »
Apache GeoIP Country Detection
Creating customised content based on the origin country of your website visitors requires installing the mod_geoip module for Apache and also the MaxMind GeoIP database as follows (on CentOS): mkdir ~/geoip cd ~/geoip wget http://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz tar xzf GeoIP* cd GeoIP* ./configure make make check make install cd .. wget http://geolite.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_1.2.5.tar.gz tar xzf mod_geoip2_1.2.5.tar.gz cd mod_geoip2_1.2.5… Read more »
Android Screenshots on Ubuntu
So I wanted to create screenshots of my HTC Hero Android phone from my Ubuntu desktop. So I … downloaded and extracted the android sdk to e.g. ~/programs cd into the ./tools directory run the ./android program Install any version specific stuff required sudo vi /etc/udev/rules.d/90-android.rules sudo service udev restart Unplug the phone and plug… Read more »
Creating a Yum Repository
Armed with a few RPMs I need to install on multiple machines and sick of SCP’ing files around machines I decided to set up a Yum repository. Here’s how: On a machine that already has Apache running and serving content: yum install createrepo cd /var/www/html/centos/5/qub/x86_64 createrepo /var/www/html/centos/5/qub/x86_64 Then on each client machine aiming to use… Read more »
PHP Web Scraping for Munin
There is a web page created by someone else containing figures I would like to use to draw some graphs in Munin. The HTML in that page is a bit ugly and looks like: <TR ALIGN = “Center”> <TD ALIGN = “Left” WIDTH = “49%” BGCOLOR = “#ECECEC”> <B>Building</B> </TD> <TD ALIGN = “Center” WIDTH… Read more »
Squid Problems
Todays installment in the Adventures of Squid Sandwich: Forwarding loop detected WARNING: Forwarding loop detected for: in /var/log/squid/cache.log Since I am using a DansGuardian sandwich with Squid for bread I set the unique_hostname host.domain.com in the first Squid conf then in the second Squid conf used a CNAME for the same machine of: unique_hostname proxy1.domain.com… Read more »

