Thursday 17 October 2013

Openelec XBMC CEC LG Remote remap

I picked up a raspberry pi to replace my Xbox XBMC was has lasted so well but is not powerful enough to play the HD MKVs I download.

One issue I found with the LG remote control I was using (on a one for all) was that the fastforward buttons were actually set to skip and the skip buttons were set to fastforward and rewind.  Also, the remote was not passing on any of the colour buttons through CEC which meant there was no extra buttons I could use for mapping an info button and a context menu button.  Also, coming from Xbox XBMC I was missing the codec info and the aspect ratio panels during playback.

Anyway, by creating /storage/.xbmc/userdata/keymaps/keymap.xml I was able to re-map the incorrect scan buttons and use the skip buttons for info and context along with the apect ratio and codec details panels I was used to from Xbox XBMC

<keymap>
<global>
    <remote>
            <skipplus>FastForward</skipplus>
            <skipminus>Rewind</skipminus>
            <forward>ContextMenu</forward>
            <reverse>Info</reverse>
    </remote>
</global>
<FullscreenVideo>
    <remote>
            <forward>CodecInfo</forward>
            <reverse>AspectRatio</reverse>
    </remote>
</FullscreenVideo>
</keymap>

Friday 20 September 2013

Zsh don't match

Not sure how I have lived without this

Match stuff (we all know this)
ls *.mkv

Dont match stuff
ls ^*.mkv

Tuesday 4 June 2013

Block cmd w from closing xterm window on mac

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.

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

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

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.