<?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>Shiv&#039;s Blog</title>
	<atom:link href="http://www.shivkaushal.co.uk/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shivkaushal.co.uk/blog</link>
	<description></description>
	<lastBuildDate>Wed, 26 Jan 2011 16:11:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Om. Nom. Nom.</title>
		<link>http://www.shivkaushal.co.uk/blog/2011/01/om-nom-nom/</link>
		<comments>http://www.shivkaushal.co.uk/blog/2011/01/om-nom-nom/#comments</comments>
		<pubDate>Wed, 26 Jan 2011 16:11:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Food]]></category>
		<category><![CDATA[London]]></category>
		<category><![CDATA[Sushi]]></category>

		<guid isPermaLink="false">http://www.shivkaushal.co.uk/blog/2011/01/om-nom-nom/</guid>
		<description><![CDATA[Last night I had the best sushi I have ever tasted in my life. It was beautiful and moving. I will be going back. Soon.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2011/01/20110126-041500.jpg"><img src="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2011/01/20110126-041500.jpg" alt="" class="alignnone size-full" /></a><br/></p>
<p>Last night I had the best sushi I have ever tasted in my life. It was beautiful and moving.</p>
<p>I will be going back. Soon. </p>
<p><br/><a href="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2011/01/20110126-041542.jpg"><img src="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2011/01/20110126-041542.jpg" alt="" class="alignnone size-full" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shivkaushal.co.uk/blog/2011/01/om-nom-nom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing 1, 2, 3</title>
		<link>http://www.shivkaushal.co.uk/blog/2011/01/testing-1-2-3/</link>
		<comments>http://www.shivkaushal.co.uk/blog/2011/01/testing-1-2-3/#comments</comments>
		<pubDate>Thu, 13 Jan 2011 23:38:37 +0000</pubDate>
		<dc:creator>Shiv</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Site]]></category>

		<guid isPermaLink="false">http://www.shivkaushal.co.uk/blog/2011/01/testing-1-2-3/</guid>
		<description><![CDATA[Nothing to do with the awesome Barenaked Ladies song; I&#8217;m testing out the WordPress iPhone app to see how well it actually works. Lots of mobile blogging on the horizon? Who knows?!?!]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2011/01/20110113-114010.jpg"><img src="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2011/01/20110113-114010.jpg" alt="" class="alignnone size-full" /></a></p>
<p>Nothing to do with the awesome Barenaked Ladies song; I&#8217;m testing out the WordPress iPhone app to see how well it actually works. </p>
<p>Lots of mobile blogging on the horizon? Who knows?!?!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shivkaushal.co.uk/blog/2011/01/testing-1-2-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create an iPhone Note from your Mac and Push it to GMail</title>
		<link>http://www.shivkaushal.co.uk/blog/2011/01/create-an-iphone-note-from-your-mac-and-push-it-to-gmail/</link>
		<comments>http://www.shivkaushal.co.uk/blog/2011/01/create-an-iphone-note-from-your-mac-and-push-it-to-gmail/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 00:13:12 +0000</pubDate>
		<dc:creator>Shiv</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Technical]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Christmas]]></category>
		<category><![CDATA[GMail]]></category>
		<category><![CDATA[Hackery]]></category>
		<category><![CDATA[Illness]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[New Year]]></category>
		<category><![CDATA[Notes]]></category>

		<guid isPermaLink="false">http://www.shivkaushal.co.uk/blog/?p=484</guid>
		<description><![CDATA[A Happy New Year to everyone! My Xmas/NYE were spent feeling pretty ill, but some groovy pills from the doctor sorted all that out relatively quickly. Apart from that, much fun was had and even more tasty food was had. Happy days! Now that&#8217;s out of the way, on with the geekery. So, I use <a href="http://www.shivkaushal.co.uk/blog/2011/01/create-an-iphone-note-from-your-mac-and-push-it-to-gmail/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center"><a href="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2011/01/iPhone-Notes.png"><img class="aligncenter size-full wp-image-485" src="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2011/01/iPhone-Notes.png" alt="iPhone Notes" width="480" height="320" /></a></p>
<p>A Happy New Year to everyone! My Xmas/NYE were spent feeling pretty ill, but some groovy pills from the doctor sorted all that out relatively quickly. Apart from that, much fun was had and even more tasty food was had. Happy days!</p>
<p>Now that&#8217;s out of the way, on with the geekery.</p>
<p><span id="more-484"></span>So, I use the iPhone Notes app to keep track of things that I need to do. Often, if I have a busy day ahead of me, I&#8217;ll want to create a to-do list. So far so normal&#8230; Doing this on the iPhone itself  can be a bit of a pain, especially if there&#8217;s a long list or a big chunk of text I want to get down. Ideally, I&#8217;d like to create it on my laptop and push it to the phone. Sadly, there&#8217;s no built in way of doing this. Luckily, since my notes get synced to my GMail account, I decided there might be a way of simply sending myself an email and it ending up in the right place. This isn&#8217;t the holy grail of being to edit the notes afterwards, without needing to do it through the iPhone, but it&#8217;s half way there and simple edits can be done without too much pain on the phone itself.</p>
<p>So off I went on my little exploratory mission. All the notes get pushed and synced by the Notes application on the iPhone to GMail and labeled &#8220;Notes&#8221; (they are also marked as read, which will be dealt with later). I looked inside a test note I created through GMails &#8220;view original&#8221; option to get a good look at the headers. Here&#8217;s what came out:</p>
<pre>Subject: Test note
From: Shiv Kaushal
X-Universally-Unique-Identifier: 85B8506D-9634-459B-971E-39C6F48869EE
Content-Type: text/html;
	charset=utf-8
X-Uniform-Type-Identifier: com.apple.mail-note
Message-Id: &lt;8BA858BB-2CBB-47F5-9029-7196A6626B25@gmail.com&gt;
Date: Mon, 10 Jan 2011 23:40:15 +0000
X-Mail-Created-Date: Mon, 10 Jan 2011 23:40:15 +0000
Content-Transfer-Encoding: 7bit
Mime-Version: 1.0 (iPhone Mail 8B117)

Test note
<div>Testing 1, 2, 3</div>
</pre>
<p>The parts that make the iPhone app pick up the messages as notes (i.e. things that aren&#8217;t there in pretty much every other message in my inbox) are <code>X-Universally-Unique-Identifier</code> and <code>X-Uniform-Type-Identifier: com.apple.mail-note</code>. So as long as I can create a message that has these features, all should work as I want.</p>
<p>Once again, I have turned to the power of bash scripting to save the day. The following script makes use of a great little GMail feature, that many people don&#8217;t know about or use, in order to let me get things going correctly. You can both punctuate your gmail username with full stops anywhere you like AND put &#8220;+blah&#8221; after the username (replacing blah with whatever you want). So, instead of someuser@gmail.com, I could use some.us.er+1337h4x@gmail.com and it would get through to the same GMail account. Without further ado, here&#8217;s the script:</p>
<pre>#!/bin/bash
FILE="/tmp/iphone-note-mail.tmp"
id=`uuidgen`

if [ -f "$1" ]
then
SUBJ=`head -n 1 $1`
echo "From: someuser@gmail.com" &gt; $FILE
echo "To: someuser+notemeup@gmail.com" &gt;&gt; $FILE
echo "Subject: $SUBJ" &gt;&gt; $FILE
echo "X-Uniform-Type-Identifier: com.apple.mail-note" &gt;&gt; $FILE
echo "X-Universally-Unique-Identifier: $id" &gt;&gt; $FILE
echo "" &gt;&gt; $FILE
cat $1 &gt;&gt; $FILE
echo "Sending new note...."
sendmail "someuser+notemeup@gmail.com" &lt; $FILE
echo Done.
echo ""

rm $FILE

exit
fi

echo "File to send not found!" 

exit</pre>
<p>Save that (changing &#8220;someuser&#8221;, obviously) somewhere in your path and be sure to <code>chmod +x</code> it &#8211; I saved it as <code>iphone-txt-to-note</code>. In order for the above script to work, you need to have specified an SMTP server, which is pretty simple to do on OS X if you follow this guide: <a href="http://hints.macworld.com/article.php?story=20081217161612647">http://hints.macworld.com/article.php?story=20081217161612647</a> &#8211; I didn&#8217;t need any of the SSL options so only needed to follow the first part of the first step. After that, you simply run the script and pass it an argument which is the path to a plain text file that you want to become your new note &#8211; <code>iphone-txt-to-note /Users/shiv/my-new-note.txt</code>, for example. The script then extracts the first line to set it as the email subject, constructs the email with the correct headers (including a randomly generated UUID), inserts the full text of your file and mails it to your GMail account. Nearly there!</p>
<p><a href="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2011/01/GMail-Notes-Rule.png"><img class="aligncenter size-medium wp-image-486" src="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2011/01/GMail-Notes-Rule-300x127.png" alt="GMail Filter for iPhone Notes" width="300" height="127" /></a></p>
<p>The final piece of the puzzle is to force GMail to put the email in the right place. The filtering in GMail doesn&#8217;t appear to let you filter based on the contents of email headers, which is why I opted to use the &#8220;+notemeup&#8221; addition to the email address being sent to. This allows us to tell GMail to select all mail sent to &#8220;someuser+notemeup@gmail.com&#8221; (you can change the tag to whatever you like, so long as it matches in the Bash script and your GMail filter), apply the &#8220;Notes&#8221; label, mark it as read and archive it so it doesn&#8217;t appear in the inbox, as shown in the image above (click to embiggen).</p>
<p>Now every time I use the Bash script, I can almost immediately open up the Notes app on my iPhone and see the newly created note.</p>
<p>Mission accomplished; Yay!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shivkaushal.co.uk/blog/2011/01/create-an-iphone-note-from-your-mac-and-push-it-to-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Have yourself an 8-bit little Xmas.</title>
		<link>http://www.shivkaushal.co.uk/blog/2010/12/have-yourself-an-8-bit-little-xmas/</link>
		<comments>http://www.shivkaushal.co.uk/blog/2010/12/have-yourself-an-8-bit-little-xmas/#comments</comments>
		<pubDate>Mon, 20 Dec 2010 14:22:47 +0000</pubDate>
		<dc:creator>Shiv</dc:creator>
				<category><![CDATA[Games]]></category>
		<category><![CDATA[Random]]></category>
		<category><![CDATA[Christmas]]></category>
		<category><![CDATA[Geekery]]></category>
		<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://www.shivkaushal.co.uk/blog/?p=451</guid>
		<description><![CDATA[To keep with the spirit of things, I thought I might share this version of a popular Christmas song, the twist being that it&#8217;s done to sound like it came out of a NES. Which can only be a good thing. Chip-tune version of  &#8221;God Rest Ye Merry Gentlemen&#8221; It&#8217;s maybe a bit &#8220;techno&#8221; in <a href="http://www.shivkaushal.co.uk/blog/2010/12/have-yourself-an-8-bit-little-xmas/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>To keep with the spirit of things, I thought I might share this version of a popular Christmas song, the twist being that it&#8217;s done to sound like it came out of a NES. Which can only be a good thing.</p>
<p><a href="http://www.shivkaushal.co.uk/link-to/God%20Bless%20Ye%208-bit%20Gentlemen.mp3">Chip-tune version of  &#8221;God Rest Ye Merry Gentlemen&#8221;</a></p>
<p>It&#8217;s maybe a bit &#8220;techno&#8221; in places,  but it mellows out towards the end. If you fancy more, there&#8217;s a <a href="http://www.doctoroctoroc.com/8BitJesus/" target="_blank">whole album you can listen to</a> (click the box at the bottom left).</p>
<p>Merry Xmas!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shivkaushal.co.uk/blog/2010/12/have-yourself-an-8-bit-little-xmas/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://www.shivkaushal.co.uk/link-to/God%20Bless%20Ye%208-bit%20Gentlemen.mp3" length="2237335" type="audio/mpeg" />
		</item>
		<item>
		<title>Unpacking an OS X pkg file</title>
		<link>http://www.shivkaushal.co.uk/blog/2010/12/unpacking-an-osx-pkg-file/</link>
		<comments>http://www.shivkaushal.co.uk/blog/2010/12/unpacking-an-osx-pkg-file/#comments</comments>
		<pubDate>Sun, 19 Dec 2010 14:44:37 +0000</pubDate>
		<dc:creator>Shiv</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Hackery]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.shivkaushal.co.uk/blog/?p=439</guid>
		<description><![CDATA[&#8220;Back in the day&#8221; Mac pkg files simply used to be folders that you could right-click and &#8220;Show Contents&#8221; or even just cd into from the command line. This is still the case for Mac applications that you just drag and drop into the Applications folder but, more recently, the format installation packages seems to <a href="http://www.shivkaushal.co.uk/blog/2010/12/unpacking-an-osx-pkg-file/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2010/12/Package1.png"><img class="aligncenter size-full wp-image-447" src="http://www.shivkaushal.co.uk/blog/wp-content/uploads/2010/12/Package1.png" alt="Mac Package Icon" width="255" height="243" /></a></p>
<p>&#8220;Back in the day&#8221; Mac pkg files simply used to be folders that you could right-click and &#8220;Show Contents&#8221; or even just <code>cd</code> into from the command line. This is still the case for Mac applications that you just drag and drop into the Applications folder but, more recently, the format installation packages seems to have changed, making getting into the guts of them a bit harder.</p>
<p><span id="more-439"></span>The newer pkg files are now just that; an individual file with all of the contents and installation scripts all compressed and wrapped up obscurely. After poking around in Google and playing around I&#8217;ve managed to figure out what&#8217;s needed to get to the goodies locked away inside. The pkg file itself is an &#8220;xar&#8221; archive &#8211; something that&#8217;s pretty new to me, but relatively easy to unpack:</p>
<pre>MBP:unpack shiv$ xar -xf Package.pkg
MBP:unpack shiv$ ls
Distribution Package.pkg  Resources    root.pkg
MBP:unpack shiv$  cd root.pkg
MBP:root.pkg shiv$  ls
Bom         PackageInfo Payload
MBP:root.pkg shiv$
</pre>
<p>It spits out a few files and folders, but you are interested in getting to the location containing the &#8220;Payload&#8221; file. This file itself is a &#8220;cpio archive compressed with gzip&#8221; according to what I could dig up online. You can unpack it with a few commands piped together.</p>
<pre>MBP:root.pkg shiv$ cat Payload | gzip -d - | cpio -id
2984 blocks
MBP:root.pkg shiv$ ls
Bom         PackageInfo Payload     private     usr
MBP:root.pkg shiv$
</pre>
<p>The new folders and files that appear are what (and where) contents would be installed, (usually) relative to the root directory of the hard drive. In my case, I was interested in getting to <code>./usr/local/bin</code> to get to some binaries that I wanted to play with without other stuff being installed into my system without a clear way of removing them.</p>
<p>Great success!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shivkaushal.co.uk/blog/2010/12/unpacking-an-osx-pkg-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Tethering Woes</title>
		<link>http://www.shivkaushal.co.uk/blog/2010/12/iphone-tethering-woes/</link>
		<comments>http://www.shivkaushal.co.uk/blog/2010/12/iphone-tethering-woes/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 02:54:29 +0000</pubDate>
		<dc:creator>Shiv</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Hackery]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.shivkaushal.co.uk/blog/?p=401</guid>
		<description><![CDATA[Another technical post this time, I am going to describe issues I&#8217;ve been having tethering my iPhone 4 to my MacBook Pro. I did eventually get a work around but it&#8217;s still not exactly great. Still, I had to piece a lot of this together by myself so this might be of interest. Having enabled <a href="http://www.shivkaushal.co.uk/blog/2010/12/iphone-tethering-woes/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Another technical post this time, I am going to describe issues I&#8217;ve been having tethering my iPhone 4 to my MacBook Pro. I did eventually get a work around but it&#8217;s still not exactly great. Still, I had to piece a lot of this together by myself so this might be of interest.</p>
<div class="separator" style="clear: both; text-align: center;"><a style="margin-left: 1em; margin-right: 1em;" href="http://1.bp.blogspot.com/_UnSRYyste54/TL95HKoYjKI/AAAAAAAAHN4/uBT40Ns_7sg/s1600/Tethering_3.0_leak_2.png"><img src="http://1.bp.blogspot.com/_UnSRYyste54/TL95HKoYjKI/AAAAAAAAHN4/uBT40Ns_7sg/s320/Tethering_3.0_leak_2.png" border="0" alt="" width="213" height="320" /></a></div>
<p><span id="more-401"></span><br />
Having enabled tethering on my iPhone 4, I thought I was ready to rock and roll with Internet access on the go &#8211; especially since the East Coast trains between London and Leeds now limit the amount of free time you get on them. Unfortunately, It wasn&#8217;t actually working. Both through the USB cable and via Bluetooth, Snow Leopard seemed unable to grab an IP address from the iPhone and I was ending up with something like the following:</p>
<div class="separator" style="clear: both; text-align: center;"><a style="margin-left: 1em; margin-right: 1em;" href="http://3.bp.blogspot.com/_UnSRYyste54/TL96sxrNUnI/AAAAAAAAHN8/zsxPg7Nj9ZM/s1600/iPhone-Self_assigned-IP.png"><img src="http://3.bp.blogspot.com/_UnSRYyste54/TL96sxrNUnI/AAAAAAAAHN8/zsxPg7Nj9ZM/s320/iPhone-Self_assigned-IP.png" border="0" alt="" width="320" height="281" /></a></div>
<p>The network service in question would always cycle from &#8220;No IP Address&#8221; to &#8220;Self-Assigned IP&#8221; and then stay that way. Basically, it was as if it was waiting for a DHCP address from the phone, but never actually getting one.</p>
<p>Initially, I thought that the phone (and TetherMe) might be to blame and that it simply wasn&#8217;t going to work. Other reports I had found suggested removing PdaNet, which I didn&#8217;t have installed and I couldn&#8217;t find much else in the way of ideas. Oddly enough, I fired up my Boot Camp Windows 7 installation and it worked first time, without any complaints at all (once I&#8217;d installed iTunes, that is).  So back into OS X I went to try and figure out what the deal was.</p>
<p>Apple actually put out a free iPhone Configuration Tool that allows you to see debug messages being output. I fired this up and proceeded to see the following messages being generated when I was trying to tether in OS X.</p>
<pre>Thu Oct 21 00:32:32 iPhone bootpd[2029] &lt;Notice&gt;: DHCP DISCOVER [en1]: 1,90:27:e4:48:XX:XX
Thu Oct 21 00:32:32 iPhone bootpd[2029] &lt;Notice&gt;: OFFER sent MBP 172.10.20.2 pktsize 300</pre>
<p>So obviously, the iPhone was receiving the DHCP requests and actually trying to respond to them. Either the response was mal-formed, or the Mac simply wasn&#8217;t dealing with the response correctly.</p>
<p>It turns out that you can monitor the DHCP traffic using tcpdump from the command line. Here&#8217;s an example of a DHCP request and response that I captured:</p>
<pre>MBP:~ $&gt;sudo tcpdump -vvv -c 2 -i en4  -n port 67
tcpdump: listening on en4, link-type EN10MB (Ethernet), capture size 65535 bytes
00:35:20.256776 IP (tos 0x0, ttl 255, id 56463, offset 0, flags [none], proto UDP (17), length 328)
0.0.0.0.68 &gt; 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 90:27:e4:48:XX:XX, length 300, xid 0x7a1edf11, secs 42, Flags [none] (0x0000)
Client-Ethernet-Address 90:27:e4:48:XX:XX
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Discover
Parameter-Request Option 55, length 10:
Subnet-Mask, Default-Gateway, Domain-Name-Server, Domain-Name
Option 119, LDAP, Option 252, Netbios-Name-Server
Netbios-Node, Netbios-Scope
MSZ Option 57, length 2: 1500
Client-ID Option 61, length 7: ether 90:27:e4:48:XX:XX
Lease-Time Option 51, length 4: 7776000
END Option 255, length 0
PAD Option 0, length 0, occurs 25

00:35:20.258306 IP (tos 0x0, ttl 255, id 12107, offset 0, flags [none], proto UDP (17), length 328)
172.10.20.1.67 &gt; 172.10.20.2.68: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0x7a1edf11, Flags [none] (0x0000)
Your-IP 172.10.20.2
Server-IP 172.10.20.1
Client-Ethernet-Address 90:27:e4:48:XX:XX
sname "iPhone"
Vendor-rfc1048 Extensions
Magic Cookie 0x63825363
DHCP-Message Option 53, length 1: Offer
Server-ID Option 54, length 4: 172.10.20.1
Lease-Time Option 51, length 4: 3564
Subnet-Mask Option 1, length 4: 255.255.255.240
Default-Gateway Option 3, length 4: 172.10.20.1
Domain-Name-Server Option 6, length 8: 82.132.254.2,82.132.254.3
END Option 255, length 0
PAD Option 0, length 0, occurs 22</pre>
<p>The response from the DCHP server running on the iPhone (bootpd) seems to be providing enough information for the Mac to set things up &#8211; IP allocation, subnet mask, gateway and DNS &#8211; so I&#8217;m not really sure what was going wrong. Also, the fact that it worked fine under Windows seemed to confirm my conclusions. The question now was; what can I do about it?</p>
<p>After a bunch of hacking around, I came up with a script that would force a DHCP renewal of the network service I was interested in, capture the conversation and then extract the data needed in order to force the manual settings on the network device.  It looks something like this:</p>
<pre>#!/bin/bash

INTERFACE="iPhone USB"
DNS="8.8.8.8, 8.8.4.4"

#Get interface name (like en3 or en4)
IF=`networksetup -listnetworkserviceorder | grep "$INTERFACE" | grep -o "Device:.*" | sed -e 's/)//g' | awk '{print $2}'`

#Make sure we are in DHCP mode and force renewal
sudo networksetup -setdhcp "$INTERFACE"
sudo ipconfig set $IF DHCP

#Grab the DHCP packets:
FULLINFO=`sudo tcpdump -vvv -c 3 -i $IF -n port 67 2&gt;/dev/null`

IP=`echo $FULLINFO | grep -o "Your-IP .*" | awk '{print $2}'`
SERVER=`echo $FULLINFO | grep -o "Default-Gateway .*" | awk '{print $6}'`
MASK=`echo $FULLINFO | grep -o "Subnet-Mask .*" | awk '{print $6}'`

echo IP: $IP - SERVER: $SERVER -  MASK: $MASK

sudo networksetup -setmanual "$INTERFACE" $IP $MASK $SERVER
sudo networksetup -setdnsservers "$INTERFACE" $DNS</pre>
<p>The INTERFACE variable can be changed to &#8220;Blutooth PAN&#8221; if required and I have forced the DNS to point to the Google DNS servers. The rest simply forces the DHCP call and answer to happen, captures 3 packets of it and then extracts the information of use. The final two lines of the script apply the network settings. I had to find out about the networksetup command in OS X, which is basically a scriptable version of most of the controls in the Networking preference pane. I also used tcpdump for the first time in the course of this little adventure. Apart from that, it&#8217;s a pretty standard shell script with good old awk and sed &#8211; probably being used incorrectly/inefficiently, but it works!</p>
<p>One thing to note is that this script leaves the network interface in a manually configured setting. Chances are that the next time you try and connect to tether, these settings will still work and you won&#8217;t need to run the script again. For the iPhone USB device, this isn&#8217;t something that you can go back in and change through the preference pane. Running the following will revert things back to how they should be.</p>
<pre>sudo networksetup -setdhcp "iPhone USB"</pre>
<p>I put the script somewhere in my path so that although I do have an additional step to force this to work in Snow Leopard, it&#8217;s as simple as opening a terminal and running a single command. In retrospect, it was a lot of hassle but kind of fun and satisfying to have got it to work.</p>
<p>This was a bit of a pain, but worth it in the end&#8230; hopefully it might be of some help to others!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shivkaushal.co.uk/blog/2010/12/iphone-tethering-woes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dealing with upper case file/foldernames</title>
		<link>http://www.shivkaushal.co.uk/blog/2010/12/dealing-with-upper-case-filefoldernames/</link>
		<comments>http://www.shivkaushal.co.uk/blog/2010/12/dealing-with-upper-case-filefoldernames/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 02:11:49 +0000</pubDate>
		<dc:creator>Shiv</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Tweak]]></category>

		<guid isPermaLink="false">http://www.shivkaushal.co.uk/blog/?p=404</guid>
		<description><![CDATA[As part of my effort to try and post more stuff, I&#8217;m going to start posting things that I have been battling with at some point and managed to overcome. I guess that the idea is that I have it all written down somewhere (memory starting to go already!) and that maybe it might be <a href="http://www.shivkaushal.co.uk/blog/2010/12/dealing-with-upper-case-filefoldernames/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>As part of my effort to try and post more stuff, I&#8217;m going to start posting things that I have been battling with at some point and managed to overcome. I guess that the idea is that I have it all written down somewhere (memory starting to go already!) and that maybe it might be helpful to someone else. The first one is a pretty simple tweak that modifies tab completion in bash.</p>
<p>Having moved over to OS X a while ago, I found it difficult at first to get to grips with the changes. I was used to both Windows and Linux at that time and was quite happy at a GUI or a command line. The Mac GUI is nice to work with (I LOVE Exposé), but working in Terminal was driving me insane for a number of reasons.</p>
<div class="separator" style="clear: both; text-align: center;"><a style="margin-left: 1em; margin-right: 1em;" href="http://2.bp.blogspot.com/_UnSRYyste54/TMgOWCUYqmI/AAAAAAAAHOQ/jR1Skk85GYM/s1600/Screen+shot+2010-10-26+at+14.03.21.png"><img src="http://2.bp.blogspot.com/_UnSRYyste54/TMgOWCUYqmI/AAAAAAAAHOQ/jR1Skk85GYM/s400/Screen+shot+2010-10-26+at+14.03.21.png" border="0" alt="" width="400" height="250" /></a><br />
<small>Exposé making life easier</small></div>
<p><span id="more-404"></span><br />
One reason was the subtle differences in required arguments and syntax for command line tools. Another was the complete absence of some tools by default, like wget. The thing that drove me insane though was the captial letters in all of the folder names &#8211; this has become a bit of an issue on Linux as well recently, but not in all of the system folders. Trying to remember which folders started with a capital letter and which didn&#8217;t wasn&#8217;t something I was willing to devote an area of my brain to, so I decided to look for another solution.</p>
<p>What I really wanted was case-insensitive tab completion. It turns out that there&#8217;s a pretty simple way of doing this. I use bash as my shell of choice, so I&#8217;m not sure if this will work for anything else &#8211; consider yourself told. The solution is as simple as opening up (and creating it, in my case) ~/.inputrc and adding the following line</p>
<pre>set completion-ignore-case on</pre>
<p>And just like that, you will have things working much more smoothly. Typing something like &#8220;cd /users/joe&#8221; won&#8217;t work because there is no folder named &#8220;/users&#8221;, but you can tab complete your way through each part of the directory structure without having to reach for that shift key.</p>
<p>As an added bonus, this also works for me in Linux (Ubuntu, namely). The method I&#8217;ve used here applies to individual users, but it seems that it&#8217;s possible that putting the same setting in /etc/inputrc might apply it for all users. It&#8217;s not something that I&#8217;ve tried out though so your mileage may vary.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shivkaushal.co.uk/blog/2010/12/dealing-with-upper-case-filefoldernames/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hello World!</title>
		<link>http://www.shivkaushal.co.uk/blog/2010/12/hello-world/</link>
		<comments>http://www.shivkaushal.co.uk/blog/2010/12/hello-world/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 03:23:17 +0000</pubDate>
		<dc:creator>Shiv</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[Site]]></category>

		<guid isPermaLink="false">http://www.shivkaushal.co.uk/?p=283</guid>
		<description><![CDATA[Hello world, indeed. I&#8217;ve finally got round to updating my web site somewhat. The first step is to transfer all of the content from my Blogger.com account into WordPress. This was surprisingly easy, but I&#8217;m pretty sure that I hard-coded some URLs back in the day, which means that things will be pretty wonky on <a href="http://www.shivkaushal.co.uk/blog/2010/12/hello-world/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<div>
<p>Hello world, indeed.</p>
<p>I&#8217;ve finally got round to updating my web site somewhat. The first step is to transfer all of the content from my Blogger.com account into WordPress. This was surprisingly easy, but I&#8217;m pretty sure that I hard-coded some URLs back in the day, which means that things will be pretty wonky on here for a little while until I go back through things and retroactively fix them.</p>
<p>I know that it&#8217;s been more than a year since I posted anything on here&#8230; a lot has happened since then. Some good, some bad. Some things I might share, others most certainly not. In any case, I find myself with some time on my hands and think that it might be best to finally move my web presence from living on the Manchester servers to something a bit more permanent and independent of where I work at any point in time. Also, it&#8217;s good to make proper use of the domain name I&#8217;ve been paying for all this time!</p>
<p>In the mean time I have the joys of selecting a WordPress theme, altering DNS records to actually point here, fixing things to match how things were before (as closely as I can) and all sorts of other fun and games.</p>
<p>Yay!</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.shivkaushal.co.uk/blog/2010/12/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>More catching up.</title>
		<link>http://www.shivkaushal.co.uk/blog/2009/07/more-catching-up/</link>
		<comments>http://www.shivkaushal.co.uk/blog/2009/07/more-catching-up/#comments</comments>
		<pubDate>Sun, 05 Jul 2009 17:44:00 +0000</pubDate>
		<dc:creator>Shiv</dc:creator>
				<category><![CDATA[Family]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Travel]]></category>
		<category><![CDATA[Blackpool]]></category>
		<category><![CDATA[China]]></category>
		<category><![CDATA[Kitu]]></category>
		<category><![CDATA[Pics]]></category>
		<category><![CDATA[Piku]]></category>
		<category><![CDATA[Weddings]]></category>

		<guid isPermaLink="false">http://www.shivkaushal.co.uk/blog/blog/2009/07/more-catching-up/</guid>
		<description><![CDATA[So, once again I am faced with the prospect of trying to get several months (at least it&#8217;s not years, this time) of events into a single entry without boring everyone to tears. One of the most interesting things to happen in a long time was my trip to China: Tienamen Square &#8211; China &#8217;09 <a href="http://www.shivkaushal.co.uk/blog/2009/07/more-catching-up/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So, once again I am faced with the prospect of trying to get several months (at least it&#8217;s not years, this time) of events into a single entry without boring everyone to tears.</p>
<p>One of the most interesting things to happen in a long time was my trip to China:</p>
<table style="width: 194px; text-align: left; margin-left: auto; margin-right: auto;">
<tbody>
<tr>
<td style="background: transparent url(http://picasaweb.google.com/s/c/transparent_album_background.gif) no-repeat scroll left center; height: 194px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" align="center"><a href="http://picasaweb.google.com/shivkaushal/TienamenSquareChina09?feat=embedwebsite"><img style="margin: 1px 0pt 0pt 4px;" src="http://lh4.ggpht.com/_UnSRYyste54/SgL_JTfdMHE/AAAAAAAAFnc/zsCxEnlATbA/s160-c/TienamenSquareChina09.jpg" alt="" width="160" height="160" /></a></td>
<td style="background: transparent url(http://picasaweb.google.com/s/c/transparent_album_background.gif) no-repeat scroll left center; height: 194px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" align="center"><a href="http://picasaweb.google.com/shivkaushal/TheGreatWallChina09?feat=embedwebsite"><img style="margin: 1px 0pt 0pt 4px;" src="http://lh6.ggpht.com/_UnSRYyste54/SgL4TdRzy4E/AAAAAAAAFfI/2U5mr0mG06A/s160-c/TheGreatWallChina09.jpg" alt="" width="160" height="160" /></a></td>
</tr>
<tr>
<td style="text-align: center; font-family: arial,sans-serif; font-size: 11px;"><a style="color: #4d4d4d; font-weight: bold; text-decoration: none;" href="http://picasaweb.google.com/shivkaushal/TienamenSquareChina09?feat=embedwebsite">Tienamen Square &#8211; China &#8217;09</a></td>
<td style="text-align: center; font-family: arial,sans-serif; font-size: 11px;"><a style="color: #4d4d4d; font-weight: bold; text-decoration: none;" href="http://picasaweb.google.com/shivkaushal/TheGreatWallChina09?feat=embedwebsite">The Great Wall &#8211; China &#8217;09</a></td>
</tr>
</tbody>
</table>
<table style="width: 194px; text-align: left; margin-left: auto; margin-right: auto;">
<tbody>
<tr>
<td style="background: transparent url(http://picasaweb.google.com/s/c/transparent_album_background.gif) no-repeat scroll left center; height: 194px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" align="center"><a href="http://picasaweb.google.com/shivkaushal/SummerPalaceChina09?feat=embedwebsite"><img style="margin: 1px 0pt 0pt 4px;" src="http://lh5.ggpht.com/_UnSRYyste54/SgL8Y7aMw5E/AAAAAAAAFng/hHcAOq24nrI/s160-c/SummerPalaceChina09.jpg" alt="" width="160" height="160" /></a></td>
<td style="background: transparent url(http://picasaweb.google.com/s/c/transparent_album_background.gif) no-repeat scroll left center; height: 194px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" align="center"><a href="http://picasaweb.google.com/shivkaushal/DingLingTombChina09?feat=embedwebsite"><img style="margin: 1px 0pt 0pt 4px;" src="http://lh4.ggpht.com/_UnSRYyste54/SgL7BRwVsUE/AAAAAAAAFnk/WdLeT7qrILE/s160-c/DingLingTombChina09.jpg" alt="" width="160" height="160" /></a></td>
</tr>
<tr>
<td style="text-align: center; font-family: arial,sans-serif; font-size: 11px;"><a style="color: #4d4d4d; font-weight: bold; text-decoration: none;" href="http://picasaweb.google.com/shivkaushal/SummerPalaceChina09?feat=embedwebsite">Summer Palace &#8211; China &#8217;09</a></td>
<td style="text-align: center; font-family: arial,sans-serif; font-size: 11px;"><a style="color: #4d4d4d; font-weight: bold; text-decoration: none;" href="http://picasaweb.google.com/shivkaushal/DingLingTombChina09?feat=embedwebsite">Ding Ling Tomb &#8211; China &#8217;09</a></td>
</tr>
</tbody>
</table>
<p><span id="more-354"></span>The trip was for work relating to the COLAB project between Leeds and Beihang Universities but there was some time for sight-seeing. There was also loads of amazing food to be had, some of it nice and spicy as well. I would have loved to have been able to have more than the 5 nights there that we did have, but you can&#8217;t really complain when a trip is for free. I flew back from China on my birthday and as a result ended up with a birthday that lasted 31 hours&#8230; this would have been great, if not for Air France messing things up and having to spend well over 20 hours of it travelling back to Leeds to get back almost exactly at midnight. The longest birthday ever, in many senses.</p>
<p>Having got through all of that, it then seemed to become wedding season again. As is occasionally the case, I ended up at a wedding where I didn&#8217;t know either of the people gettting married at all. This is a real issue I have with the way Indian weddings are done. Even still, I managed to eat the nice food and managed to get an interesting array of deserts for myself:</p>
<table style="width: 194px; text-align: left; margin-left: auto; margin-right: auto;">
<tbody>
<tr>
<td style="background: transparent url(http://picasaweb.google.com/s/c/transparent_album_background.gif) no-repeat scroll left center; height: 194px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;" align="center"><a href="http://picasaweb.google.com/shivkaushal/SanjeevAndAmy?feat=embedwebsite"><img style="margin: 1px 0pt 0pt 4px;" src="http://lh4.ggpht.com/_UnSRYyste54/SglRgsWhIJE/AAAAAAAAFcE/68WLuLVz2qw/s160-c/SanjeevAndAmy.jpg" alt="" width="160" height="160" /></a></td>
</tr>
<tr>
<td style="text-align: center; font-family: arial,sans-serif; font-size: 11px;"><a style="color: #4d4d4d; font-weight: bold; text-decoration: none;" href="http://picasaweb.google.com/shivkaushal/SanjeevAndAmy?feat=embedwebsite">Sanjeev and Amy</a></td>
</tr>
</tbody>
</table>
<p>I also got to go to Sanjay&#8217;s wedding to my latest Bhabiji, Priya. The whole process was good, even if Vijay did take delight in telling me that I was dressed up like a genie:</p>
<table style="width: 194px;">
<tbody>
<tr align="center">
<td style="background: transparent url(http://picasaweb.google.com/s/c/transparent_album_background.gif) no-repeat scroll left center; height: 194px; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"><a href="http://picasaweb.google.com/shivkaushal/SanjayAndPriya?feat=embedwebsite"><img style="margin: 1px 0pt 0pt 4px;" src="http://lh6.ggpht.com/_UnSRYyste54/SkDWrd8JeGE/AAAAAAAAF8Y/QHmsNS_hqKg/s160-c/SanjayAndPriya.jpg" alt="" width="160" height="160" /></a></td>
</tr>
<tr align="center">
<td style="font-family: arial,sans-serif; font-size: 11px;"><a style="color: #4d4d4d; font-weight: bold; text-decoration: none;" href="http://picasaweb.google.com/shivkaushal/SanjayAndPriya?feat=embedwebsite">Sanjay and Priya</a></td>
</tr>
</tbody>
</table>
<p>The only bad thing about all of this is that apparently, I&#8217;m next. While there&#8217;s been no huge amount of pressure from anyone or anywhere, all the little nudges and winks and &#8220;when are you getting married then&#8221; comments add up. It&#8217;s not that I&#8217;m averse to the idea; I just hate the concept that my life should run according to someone else&#8217;s (or many other people&#8217;s) schedule. Still, it would be potentially stupid to not even meet someone that is being suggested to me. As someone once said to me many years ago in a drunken conversation; she could be smokin&#8217; hot. Even getting beyond all that, the chances that all the various astrological superstitions and other barriers to potential introductees are overcome, there&#8217;s still the problem of this person being able to tolerate me, at the very least. I&#8217;m not exactly holding my breath.</p>
<p>I&#8217;m sure there&#8217;s a ton of other stuff I&#8217;m forgetting. The main thing in my mind at the moment is that all of the people in Blackpool are (thankfully) on their way to a recovery following what sounds like a pretty horrendous crash on the M1. Especially the kids. Hopefully I will be able to get round there and lift people&#8217;s spirits with my own special brand of entertainment.</p>
<p>Finally, I will say <a href="http://news.bbc.co.uk/sport1/hi/tennis/8133424.stm">congratulations Roger Federer</a>. It was sad to see Roddick almost crying, but I did want Federer to win. It was an epic match.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shivkaushal.co.uk/blog/2009/07/more-catching-up/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>With apologies to Piku</title>
		<link>http://www.shivkaushal.co.uk/blog/2009/03/with-apologies-to-piku/</link>
		<comments>http://www.shivkaushal.co.uk/blog/2009/03/with-apologies-to-piku/#comments</comments>
		<pubDate>Sun, 29 Mar 2009 10:03:00 +0000</pubDate>
		<dc:creator>Shiv</dc:creator>
				<category><![CDATA[Family]]></category>
		<category><![CDATA[Birthday]]></category>
		<category><![CDATA[Blackpool]]></category>
		<category><![CDATA[Piku]]></category>

		<guid isPermaLink="false">http://www.shivkaushal.co.uk/blog/blog/2009/03/with-apologies-to-piku/</guid>
		<description><![CDATA[So apparently I&#8217;m the worst uncle in the world ever. Not only did I forget to mention Piku&#8217;s birthday on here in December but I seem to have no pictures or anything to put up for it either. I&#8217;d like to take the opportunity to apoligise from the bottom of my heart and beg for <a href="http://www.shivkaushal.co.uk/blog/2009/03/with-apologies-to-piku/"> read more <span class="meta-nav">&#187;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So apparently I&#8217;m the worst uncle in the world ever.</p>
<p>Not only did I forget to mention Piku&#8217;s birthday on here in December but I seem to have no pictures or anything to put up for it either. I&#8217;d like to take the opportunity to apoligise from the bottom of my heart and beg for forgiveness.</p>
<p>It all happened quite a while ago now, so my memory is a little bit hazy. I do remember that we tricked Piku into thinking that nobody else was coming and that she&#8217;d have to make do with only me (what a horrible prospect!).  Anyway, I got Piku the following toy:</p>
<p style="text-align: center;"><img src="http://www.baby99.co.uk/f-3/110096/Science-Museum-My-Mystery-UFO.jpg"/></p>
<p>There&#8217;s a trick to it of course, but the idea is that it should look like it&#8217;s just floating in the air.</p>
<p>Hopefully the next time I&#8217;m in Blackpool, Piku will have mastered it&#8230;. though it is pretty tricky to get right.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shivkaushal.co.uk/blog/2009/03/with-apologies-to-piku/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

