Skip to content

Instantly share code, notes, and snippets.

View nevali's full-sized avatar
🏳️‍🌈
Always, always busy

Mo McRoberts nevali

🏳️‍🌈
Always, always busy
View GitHub Profile
@nevali
nevali / Notes.txt
Created October 2, 2009 22:51
All of this so that I have some realistic test data…
This information is pieced together from a combination of the /programmes RDF and the TV-Anytime metadata published by backstage.
If I could be bothered, I’d tweak the script to show whether each programme is available on iPlayer currently or not.
The pids are for the versions. The broadcast pids aren't published, as far as I can tell, so I can only pin it down as far as version.
The crids and dvb:// URLs are from the backstage data but some major caveats:
1. I've got a sneaking feeling the crids:// don't match what bounces between PIPS and BDS, so I'm not sure how they come to exist.
2. The high 16 bits of the crid match the service ID component of the dvb:// URL (in this case, 1044 [hex]). The low 16 bits _usually_ match the dvb:// event ID too, but this breaks on repeat broadcasts.
<!-- Where #login-auth is your password field and #login-iri is your username. Change as appropriate -->
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$('#login-auth').chromaHash({bars: 3});
$('#login-iri').focus();
var i;
i = setInterval(function() {
if(($('#login-auth').val()))
{
clearInterval(i);
@nevali
nevali / NSObject.php
Created January 6, 2010 23:18
NSObject in PHP
<?php
/* Note that this code makes use of late static binding, introduced in
* PHP 5.3.
*
* This is basically one great big dirty hack for curiosity’s sake.
*/
class NSObject
{
@nevali
nevali / extract.php
Created January 19, 2010 13:51
Return an array containing all text delimited by $start and $end
<?php
/* Return an array containing all text delimited by $start and $end */
function str_extract($source, $start, $end)
{
$matches = array();
$ofs = 0;
$sl = strlen($start);
$el = strlen($end);
$l = strlen($source);
@nevali
nevali / iPlayer.html
Created January 23, 2010 12:39
Embedding iPlayer
<!--
Every iPlayer programme has a "PID", which is in the URL for each iPlayer programme page. For example, "b00pwv65". iPlayer URLs take the form: http://www.bbc.co.uk/iplayer/episode/PID/other-stuff-which-doesn't-matter
Replace "**** PID GOES HERE ****" in the code below with the PID of the programme you want to embed, and you’re set.
For example:
http://www.bbc.co.uk/iplayer/episode/b0074fll/Doctor_Who_Series_2_New_Earth/
@nevali
nevali / gist:322730
Created March 5, 2010 13:48
Eregansu deployment prototype post-receive hook
#!/bin/sh
## Setup is basically thus:
##
## On your server:
##
## $ mkdir production.git /path/to/website
## $ cd production.git
## $ git init --bare
## $ git config core.worktree /path/to/website
cd /Library/Application\ Support/VMware\ Fusion/isoimages
mkdir backup
mv *.sig darwin.iso backup/
perl -n -p -e 's/ServerVersion.plist/SystemVersion.plist/g' < backup/darwin.iso > darwin.iso
openssl genrsa -out tools-priv.pem 2048
openssl rsa -in tools-priv.pem -pubout -out tools-key.pub
for i in *.iso ; do openssl dgst -sha1 -sign tools-priv.pem < $i > $i.sig ; done
@nevali
nevali / client.php
Created March 8, 2010 22:03
User Agent/Referrer Verification
<?php
/* Client sample implementing User Agent/Referrer Verification */
/* Generate $key based on the contents of this resource */
$referrer = 'http://example.com/page';
/* This is our User-Agent string. The server must be expecting requests from this User-Agent. */
$ua = 'My User Agent/1.0';
/* Note that the client must have access to $referrer in order to generate the sha256-hmac */
@nevali
nevali / jquery.dc-html.js
Created March 16, 2010 16:04
This is an extension to rdfQuery to glean DC-HTML metadata from a document. It's quick, it's dirty, it probably doesn't work properly.
(function ($) {
var ns = {}, parsedNS = false;
parseNS = function() {
parsedNS = true;
var l =$('link[rel^=schema\.]');
if(l && l[0])
{
l.each(function() {
var uri;
@nevali
nevali / gist:352971
Created April 2, 2010 09:30
Without a shadow of the doubt, one of the worst poems in the world
“Help! Help!”, I cry.
“If Excel won’t work, I might die”
So I pick up the phone and call I—
—T.
“Have you tried turning it off and on again?”, they enquire.
And, no, I have not — so do as they desire.
As if by magic, some miraculous feat,
the genius in IT fixed my spreadsheet.