Wednesday 23 January 2013

Global search and replace with sed

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 "href=\"\/static\/" .`; sudo sed -i -e 's/href=\"\/static\//href=\"\/applications\/static\//g' $file

Thursday 17 January 2013

SSH Pseudo terminals

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"

Wednesday 16 January 2013

Disable php deprecation warnings per apache virtual host

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.