Global search and replace with sed

Posted on Wed 23 January 2013 in misc • Tagged with zsh

So today I needed to replace a few hundred href link in varying content today.  Here's my take on solving it. This works in zsh.  I think for bash you need to add the do and done parts of the for loop, i'm not sure.

for file in `grep -lR …


Continue reading

SSH Pseudo terminals

Posted on Thu 17 January 2013 in misc • Tagged with ssh

There is always so much more to SSH than I know about.  Here is another discovery I made today.  This allows me to ssh into a machine via a gateway in just one command care of the -t flag

ssh -t agatewaymachine.com "ssh 192.168.1.253"


Continue reading

Disable php deprecation warnings per apache virtual host

Posted on Wed 16 January 2013 in misc • Tagged with apache, php

php_value error_reporting 6135

Seems you have to use the numerical value in apache for this.  This should be all E_ALL minus E_DEPRECATED AND E_USER_DEPRECATED

This will only work if the error handling function is not overridden in the php code.


Continue reading

Life with systemd Part 2

Posted on Thu 15 November 2012 in misc • Tagged with systemd

systemd rocks!  I really did not think I had the patience to learn it, but now I understand it and have played about with it, I think it is brilliant if not for one reason alone - creating service files are trivial, which is how it should be.  In SysVInit I …


Continue reading

Life With systemd Part1

Posted on Thu 15 November 2012 in misc • Tagged with systemd

I rolled out a new server recently and very nearly did not put opensuse on it based and the thought of having to learn systemd.  I can see why SysVInit could have done with being replaced but I didn't really see it as pressing.  Anyway, here's my braindump of learning …


Continue reading

Fun with lsof

Posted on Wed 14 November 2012 in misc • Tagged with lsof

lsof (list open files) is a tool I have used recently for discovering which service is using a certain port.  We also had a issue recently where our /var partition was showing 0 bytes free, but du -csh /var was showing over 1.5GB free.  Using lsof | grep deleted we …


Continue reading

Vim formatting goodness

Posted on Wed 20 June 2012 in misc • Tagged with vim

So I wanted to paste this licence into my piece of code http://www.opensource.org/licenses/bsd-license.php

But I wanted it be wrapped to no more than  79 characters a line and before each sentence I wanted to insert a "# "

This is how

:set paste (paste text from …

Continue reading

Listing all available package versions with yum

Posted on Wed 13 June 2012 in misc • Tagged with yum

Sometime I needs to install an older flavour of a package.  You can list these with yum and install a specific version, e.g.

yum --showduplicates list mod_ssl
yum install mod_ssl-2.2.3-53.el5

Continue reading

Tracing Redirects with curl

Posted on Thu 31 May 2012 in misc • Tagged with curl

I quite often need to debug rewrites and redirects and with curl this is quite easy.

curl -I -L "http://somewhere.com"

also you can add the -k option to ignore invalid certificate errors


Continue reading

SSH Piping between remote servers

Posted on Wed 25 January 2012 in misc • Tagged with ssh

SSH is without doubt my favorite command line tool. Today I needed to transfer a file between two hosts that I could SSH to, but could not SSH to each other. This is really simple with a bit of standard UNIX piping.

ssh hostA cat somescript.sh | ssh hostB "cat …


Continue reading