After doing this at least twice in 24 hours I thought I better sort this out. You can block cmd w (close window) and assign it to something else to stop this from happening.
Goto System Preferences -> Keyboard -> Keyborad Shortcuts -> Application Shortcuts
Then Add (+)
Application = X11.app
Window = Close
Shortcut = Whatever you want I use cmd+shift+w
Danke.
Tuesday, 4 June 2013
Sunday, 24 March 2013
Creating An RPM for openSUSE - some notes
I wanted to create an rpm which I had not done before. Here are some notes on the process.
I created a user on my machine for this process called rpmbuilder.
Create a folder for development and create the layout for developing rpms
mkdir rpmdevenv; cd rpmdevenv
mkdir BUILD RPMS SOURCES SPECS SRPMS
Create the file ~/.rpmmacros with
%packager High Fructose Corn Syrup
%_topdir /home/rpmbuilder/rpmdevenv
%_rpmtopdir %{_topdir}
%_builddir %{_rpmtopdir}/BUILD
%_rpmdir %{_rpmtopdir}/RPMS
%_sourcedir %{_rpmtopdir}/SOURCES
%_specdir %{_rpmtopdir}/SPECS
%_srcrpmdir %{_rpmtopdir}/SRPMS
Add source code to SOURCES
Add .spec file to SPECS
Build the rpm from the SPEC
rpmbuild -ba SPECS/something.spec
Some good references
Tuesday, 5 February 2013
Returning the HTTP code of a HTTP request
This is really useful for returning HTTP code of a request.
curl --write-out "%{http_code}\n" --silent --output /dev/null www.example.com
curl --write-out "%{http_code}\n" --silent --output /dev/null www.example.com
Find all unique url's from Apache log files
I needed to build a list of all unique hits that had been made on a website in Apache.
Here's what I came up with using awk and sed. This should match any HTTP 2xx or 3xx requests and strip of any GET request parameters.
awk '$9 ~/^(2|3)/ {print $7}' somelogs* | sed 's/\?.*$//' | sort | uniq
Here's what I came up with using awk and sed. This should match any HTTP 2xx or 3xx requests and strip of any GET request parameters.
awk '$9 ~/^(2|3)/ {print $7}' somelogs* | sed 's/\?.*$//' | sort | uniq
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
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"
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.
This will only work if the error handling function is not overridden in the php code.
Subscribe to:
Posts (Atom)