<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Who is Chris Neale? &#187; insanity</title>
	<atom:link href="http://who-is.chrs.nl/tag/insanity/feed/" rel="self" type="application/rss+xml" />
	<link>http://who-is.chrs.nl</link>
	<description>who-is.chrs.nl?</description>
	<lastBuildDate>Mon, 30 Aug 2010 16:20:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Tweeting MythTV events in the new OAuth era</title>
		<link>http://who-is.chrs.nl/2010/08/30/tweeting-mythtv-events-in-the-new-oauth-era/</link>
		<comments>http://who-is.chrs.nl/2010/08/30/tweeting-mythtv-events-in-the-new-oauth-era/#comments</comments>
		<pubDate>Mon, 30 Aug 2010 16:05:24 +0000</pubDate>
		<dc:creator>cdn</dc:creator>
				<category><![CDATA[MythTV]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[insanity]]></category>
		<category><![CDATA[perl]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[vanity]]></category>

		<guid isPermaLink="false">http://who-is.chrs.nl/?p=217</guid>
		<description><![CDATA[The mythtv wiki has a few scripts for tweeting MythTV stuff to twitter; although they all relied upon Basic Auth. until recently. Taking a leaf out of Twitter Tools&#8216; book it&#8217;s possible to convert the LWP::UserAgent-based code to do OAuth. &#8230; <a href="http://who-is.chrs.nl/2010/08/30/tweeting-mythtv-events-in-the-new-oauth-era/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.mythtv.org/wiki/">The mythtv wiki</a> has <a href="http://cdn.cx/mythtweet">a few scripts for tweeting MythTV stuff</a> to twitter; although they all relied upon Basic Auth. until recently.</p>
<p>Taking a leaf out of <a href="http://alexking.org/projects/wordpress">Twitter Tools</a>&#8216; book it&#8217;s possible to convert the LWP::UserAgent-based code to do <a href="http://oauth.net/">OAuth</a>.</p>
<p>Before:</p>
<p><code>#!/usr/bin/perl<br />
use LWP::UserAgent;<br />
my $output = shift;<br />
my $browser = LWP::UserAgent->new;<br />
my $url = 'http://twitter.com/statuses/update.json';<br />
$browser->credentials('twitter.com:80', 'Twitter API', 'username', 'password');<br />
$response = $browser->get("http://twitter.com/account/verify_credentials.json");<br />
my $response = $browser->post($url, {status => $output});</code></p>
<p>First step is registering an App. at <a href="//dev.twitter.com/">dev.twitter.com</a>, so that you&#8217;ve got the necessary authentication keys to do <a href="http://dev.twitter.com/pages/oauth_single_token">OAuth directly with an access token</a>.</p>
<p>See also: http://wphelpcenter.com/plugins/twitter-tools/</p>
<p>Secondly, you&#8217;ll need a means of performing OAuth in perl, I chose <a href="http://search.cpan.org/~miyagawa/Net-Twitter-OAuth/lib/Net/Twitter/OAuth.pm">Net::Twitter:OAuth</a>, the <a href="http://search.cpan.org/~miyagawa/Net-Twitter-OAuth-0.02/lib/Net/Twitter/OAuth.pm">0.02 version page</a>&#8216;s example forming the basis for the simplest twitter.pl upgrade.</p>
<p>After:</p>
<p><code>#!/usr/bin/perl<br />
  use Net::Twitter::OAuth;<br />
  my $client = Net::Twitter::OAuth->new(<br />
      consumer_key    => "",<br />
      consumer_secret => "",<br />
  );<br />
  my $output = shift @ARGV;<br />
#  $client->oauth_token('', '');<br />
# DEPRECATED: use access_token and access_token_secret instead at ./oauth-mtv-tweet.pl line X<br />
  $client->access_token('');<br />
  $client->access_token_secret('');<br />
  my $res    = $client->update({ status => $output });<br />
</code></p>
<p>The more complex twitter.pl script can be upgraded in much the same way:</p>
<p>After:<br />
<code>#!/usr/bin/perl<br />
#use LWP::UserAgent;<br />
 use Net::Twitter::OAuth;<br />
  my $client = Net::Twitter::OAuth->new(<br />
      consumer_key    => "xxxxxxxxxxxxxxxxxx",<br />
      consumer_secret => "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",<br />
  );<br />
  $client->access_token('xxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');<br />
  $client->access_token_secret("xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx");<br />
#<br />
use DBI;<br />
use DBD::mysql;<br />
use MythTV;<br />
#<br />
my $connect;<br />
my $debug = 0;<br />
my $title="";<br />
my $subtitle="";<br />
my $newsubtitle="";<br />
my $starttime="";<br />
my $chanid="";<br />
#<br />
##################################<br />
#                                #<br />
#    Main code starts here !!    #<br />
#                                #<br />
##################################<br />
#<br />
my $usage = "\nHow to use twitter.pl \n\ twitter.pl starttime=%STARTTIME% chanid=%CHANID% debug\n"<br />
        ."\n%CHANID% = channel ID associated with the recording\n"<br />
        ."%STARTTIME% = recording start time in either 'yyyy-mm-dd hh:mm:ss' or 'yyyymmddhhmmss' format\n"<br />
        ."debug = enable debugging information - outputs which commands would be run etc\n";<br />
#<br />
# get this script's ARGS<br />
#<br />
#<br />
my $num = @ARGV;<br />
#<br />
# if user hasn't passed enough arguments, die and print the usage info<br />
#<br />
if ($num le "1") {<br />
        die "$usage";<br />
}<br />
#<br />
#<br />
# Get all the arguments<br />
#<br />
#<br />
foreach (@ARGV){<br />
    if (/debug/) {<br />
        $debug = 1;<br />
    }<br />
    elsif (/starttime/) {<br />
        $starttime = (split(/=/))[1];<br />
    }<br />
    elsif (/chanid/) {<br />
        $chanid = (split(/=/))[1];<br />
    }<br />
}<br />
#<br />
# connect to backend<br />
my $myth = MythTV->new;<br />
# connect to database<br />
my $connect = $myth->{dbh};<br />
#<br />
my $query = "SELECT name FROM channel WHERE chanid=$chanid";<br />
my $query_handle = $connect->prepare($query);<br />
$query_handle->execute  or die "Unable to query channel table";<br />
#<br />
my ($channame) = $query_handle->fetchrow_array;<br />
#<br />
$query = "SELECT title, subtitle, endtime FROM recorded WHERE chanid=$chanid and starttime='$starttime'";<br />
$query_handle = $connect->prepare($query);<br />
$query_handle->execute  or die "Unable to query settings table";<br />
#<br />
$query_handle->bind_columns(undef, \$title, \$subtitle, \$endtime);<br />
$query_handle->fetch;<br />
#<br />
if ($subtitle)<br />
{<br />
$newsubtitle = " - ".$subtitle;<br />
}<br />
#<br />
my $output = "Finished recording $title $newsubtitle from $channame at $endtime";<br />
    print "Chanid $chanid \n";<br />
    print "Starttime $starttime \n";<br />
    print "$output \n";<br />
#<br />
unless ($debug)<br />
{<br />
#<br />
  my $res    = $client->update({ status => $output });<br />
#<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://who-is.chrs.nl/2010/08/30/tweeting-mythtv-events-in-the-new-oauth-era/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Yes, this IS getting boring</title>
		<link>http://who-is.chrs.nl/2010/05/24/yes-this-is-getting-boring/</link>
		<comments>http://who-is.chrs.nl/2010/05/24/yes-this-is-getting-boring/#comments</comments>
		<pubDate>Mon, 24 May 2010 16:56:14 +0000</pubDate>
		<dc:creator>cdn</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[insanity]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://who-is.chrs.nl/?p=191</guid>
		<description><![CDATA[Upgraded most of the short linking I&#8217;ve been doing outside wordpress/la-petite-url to use yourls; except, of course, that a quick bit of sql didn&#8217;t translate everything. The MySQL insert into yourls_url select key1, target, timestamp(concat(year, '-', month, '-',day, ' 12:00:00')), &#8230; <a href="http://who-is.chrs.nl/2010/05/24/yes-this-is-getting-boring/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Upgraded most of the short linking I&#8217;ve <ins>been</ins> doing outside wordpress/la-petite-url to use yourls; except, of course, that a quick bit of sql didn&#8217;t translate everything.</p>
<p>The MySQL</p>
<p><code>insert into yourls_url select key1, target, timestamp(concat(year, '-', month, '-',day, ' 12:00:00')), '10.0.0.1', clicks from shorty_shorties;</code></p>
<p>The Problem<br />
One shorty link was hyphenated, not something yourls allows.</p>
<p>So, some .htaccess hackery required, again &#8230;</p>
<p><code>RewriteRule ^([0-9A-Za-z-]+)-([0-9A-Za-z-]+)?/?$ /yourls-go.php?id=$1$2 [L]</code></p>
]]></content:encoded>
			<wfw:commentRss>http://who-is.chrs.nl/2010/05/24/yes-this-is-getting-boring/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vanity: A &#8220;no, this blog isn&#8217;t just about shorturls&#8221; post on shorturls</title>
		<link>http://who-is.chrs.nl/2010/01/30/a-no-this-blog-isnt-just-about-shorturls-post-on-shorturls/</link>
		<comments>http://who-is.chrs.nl/2010/01/30/a-no-this-blog-isnt-just-about-shorturls-post-on-shorturls/#comments</comments>
		<pubDate>Sat, 30 Jan 2010 23:22:22 +0000</pubDate>
		<dc:creator>cdn</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[custom]]></category>
		<category><![CDATA[insanity]]></category>
		<category><![CDATA[insomnia]]></category>
		<category><![CDATA[kazakhstan]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[redirect]]></category>
		<category><![CDATA[russian]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[tiny]]></category>
		<category><![CDATA[uri]]></category>
		<category><![CDATA[url]]></category>
		<category><![CDATA[vanity]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://who-is.chrs.nl/?p=145</guid>
		<description><![CDATA[Last Saturday, I woke up with a seemingly brilliant idea, a dot-st domain name for use by my online postage half-site Print My Postage, mypo.st was subsequently registered. However, this isn&#8217;t about that; I was on skype telling Brian (King) &#8230; <a href="http://who-is.chrs.nl/2010/01/30/a-no-this-blog-isnt-just-about-shorturls-post-on-shorturls/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Last Saturday, I woke up with a seemingly brilliant idea, a dot-st domain name for use by my online postage half-site <a href="http://printmypostage.co.uk/">Print My Postage</a>, mypo.st was subsequently registered. However, this isn&#8217;t about that; I was on skype telling <a href="http://brian.kingsonline.net/talk/">Brian</a> (King) about this and mused that bri.ks would be a good vanity shortener for <a href="http://briks.si/">briks.si</a> his mozilla software development collective. Unfortunately, Kosovo&#8217;s dot-ks doesn&#8217;t actually exist; fortunately Kazakhstan&#8217;s dot-kz does. I proposed that Brian and briks.si should have their own shortener under bri.kz, with briks.si/! as the install location; why use one of the virtual servers of the hosting account purely for bri.kz, when it&#8217;s all the same server.</p>
<p>Now on cdn: How not to register a dot-kz domain.</p>
<p>The fun really started after <a href="http://yourls.org/">YOURLS</a> was installed to handle the shortener system, first question: &#8220;where to register bri.kz?&#8221;, I went down <a href="http://www.nic.kz/srs/registrars.jsp">the list of registrars</a> at KazNIC (nic.kz) trying to find one with English as a language option (Cyrillic is bewildering), I settled on http://www.regtime.net/ (.kz 550 rubels per year roughly $20 in Jan 2010), although their https certificate turned out to be <a href="http://webnames.ru/">webnames.ru</a> (<a href="http://getfirefox.com/">Firefox</a> mismatch warning good for your sanity).</p>
<div>
Find your own dot-kz domain(s):<br />
<form action="http://www.webnames.ru/en/scripts/check.pl" method="post">
<p>www.<br />
<input name="domname" size="16" type="text" />
<input alt="Проверить!" src="http://www.webnames.ru/wnpix/check.gif" type="image" />
<input name="bid" type="hidden" value="130793" /></p>
</form>
</div>
<p>It turned out, that to pay the registration fee to webnames.ru I needed to use a web currency; I chose WebMoney&#8217;s WMZ [USD equivalent], signed up for an account (wmtransfer.com) only to find that I needed another account elsewhere to fund the WMZ purse at WebMoney from my credit card.</p>
<p>Note: this is past midnight, so now early Sunday morning.</p>
<p>Off to savechange.ru, signup, login, fill in WMZ purse number.</p>
<p>Liqpay using Ukrainian bank with MasterCard SecureCode whatsit for verification still wanted to verify me, pending micropayments to card no good since only tracked in GBP what with Liqpay wanting USD, so I talked to Liqpay who eventually talked to my card bank, Liqpay authorised payment, savechange converted it from USD to WMZ and I was able to pay the webnames invoice</p>
<p>Technical</p>
<p>root .htaccess sends bri.kz traffic to briks.si/! which sends it to YOURLS to handle</p>
<p>/.htaccess, mod_rewrite [P] no good all referrers briks.si itself; basic redirect, again no good, no referrers at all; solution [E ..] set environment variable between redirects.</p>
<p><code>RewriteCond %{HTTP_HOST} ^bri\.kz$<br />
RewriteCond %{REQUEST_FILENAME} !-f<br />
RewriteCond %{REQUEST_FILENAME} !-d<br />
RewriteRule ^(.*) http://briks.si/!/$1 [E=HTTP_REFERER:%{HTTP_REFERER}]</code></p>
]]></content:encoded>
			<wfw:commentRss>http://who-is.chrs.nl/2010/01/30/a-no-this-blog-isnt-just-about-shorturls-post-on-shorturls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
