<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>Sagar Pandya</title><generator>Tumblr (3.0; @sagarpandya)</generator><link>http://blog.sagarpandya.com/</link><item><title>Re%3A iPhone tether on Ubuntu</title><description>&lt;p&gt;Scratch that. I figured out how to tether via Bluetooth on Ubuntu. Firstly, install blueman from &lt;a href="http://blueman-project.org/" target="_blank"&gt;here&lt;/a&gt;. Blueman is a Bluetooth manager replacement for Gnome that is about 30 billion times better than the default. Next, make sure your computer is discoverable, and pair FROM THE iPHONE. That&amp;#8217;s the important step that I failed at when I tried this before. Once your computer is paired, you can open up Blueman, right click your phone, and go to &amp;#8220;Network Access&lt;/p&gt;</description><link>http://blog.sagarpandya.com/post/313285279</link><guid>http://blog.sagarpandya.com/post/313285279</guid><pubDate>Sat, 02 Jan 2010 11:37:49 -0800</pubDate></item><item><title>iPhone tether on Ubuntu</title><description>&lt;p&gt;This is a note for my own reminder. It&amp;#8217;s also sort of a cheap hack. iPhone 3.0 has the ability to tether to a computer over Bluetooth or USB. The task is made extremely simple on Windows and Mac, but I haven&amp;#8217;t really figured out a way to take advantage of the iPhone&amp;#8217;s tethering feature on Ubuntu. Maybe some day it will be integrated into NetworkManager, but in the mean time, we&amp;#8217;re forced hack our way to a functional existence. So the method I found that works requires a jailbroken iPhone. Here&amp;#8217;s how to do it. Note that obviously this can be done on almost any distribution of Linux with minor modifications to the steps.
&lt;/p&gt;&lt;ol&gt;&lt;li&gt; Download &lt;a href="http://matt.colyer.name/projects/iphone-linux/index.php?title=Main_Page" target="_blank"&gt;libiphone&lt;/a&gt;. To do this in Ubuntu 9.04, just add these lines to your sources list, along with their key (F0876AC9). Then &lt;code&gt;apt-get update &lt;/code&gt;&lt;/li&gt;&lt;/ol&gt;</description><link>http://blog.sagarpandya.com/post/313285264</link><guid>http://blog.sagarpandya.com/post/313285264</guid><pubDate>Sat, 02 Jan 2010 11:37:48 -0800</pubDate></item><item><title>Re%3A Sleep</title><description>&lt;p&gt;So I stopped taking melatonin and drinking coffee last Friday. I went to bed at reasonable times this weekend, and woke up without the aid of an alarm clock at around 7-8. It felt pretty good. Last night, I couldn&amp;#8217;t sleep and lay awake restlessly until about 2:00am. But I woke up easily at 7:30am feeling pretty good. I know it usually takes a lot longer than a single day to change your sleeping pattern, but I&amp;#8217;m hoping this trend continues. I&amp;#8217;m about to go to sleep again (without melatonin) and hopefully I&amp;#8217;ll wake up feeling good at around 7 again. I have about a month before the GRE and I hope I can get this sleeping issue out of the way by then.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s hard to believe, but I used to wake up every day and get to class by 8:15am in high school. That memory seems remote and distant now. Then suddenly in college, 11am classes were almost impossible to wake up in time for. Now I&amp;#8217;m sort of in between. Soon I&amp;#8217;ll be in grad school where I&amp;#8217;ll have to be especially disciplined about sleep. With a bad sleeping pattern, my whole life becomes pervaded by a bleak fogginess. The simplest daily tasks seem impossible or simply not worth doing. My actions seem vague, like I&amp;#8217;m watching them peripherally from a distance. I imagine it&amp;#8217;s what depression is like, only not nearly as crippling. The memories of time spent this way are even more discomforting. It&amp;#8217;s like huge swathes of time have shrunk away; not gone, just somehow shortened.&lt;/p&gt;</description><link>http://blog.sagarpandya.com/post/313285248</link><guid>http://blog.sagarpandya.com/post/313285248</guid><pubDate>Sat, 02 Jan 2010 11:37:47 -0800</pubDate></item><item><title>Sleep and robots</title><description>&lt;p&gt;I&amp;#8217;ve been having sleep related troubles for a few weeks. If I leave my eyes open in the dark, strange imaginary apparitions cast themselves about the room from within my sleepy mind. I find it difficult to wake up in the morning, and I&amp;#8217;m tired all day long. I take 6mg melatonin almost every night, and I have been for over 2 years. I try to go to sleep between 10:30-11pm every night, and try to wake up at 7am every morning. However, I am usually unsuccessful at waking up at this time. Dad says maybe melatonin has a cumulative effect across multiple days, and its lingering traces in my brain are making it difficult to wake up. He also suggested that I might just need more sleep. So now I&amp;#8217;m going to stop taking melatonin, and also try to sleep earlier. Maybe 9:30-10:00pm every night? I don&amp;#8217;t know how successful I&amp;#8217;ll be at that, but I can easily stop taking melatonin. I don&amp;#8217;t like taking it anyway; it feels like a crutch.

On separate notes, here are things I&amp;#8217;ve done lately that make me feel happy:
&lt;/p&gt;&lt;ul&gt;&lt;li&gt;I started using Google&amp;#8217;s Chromium browser on Linux. I like its speed and minimal interface. I know I&amp;#8217;m a bit late to the game, but can you blame me? Chromium has been sort of unstable for a while, and just recently gained features like &amp;#8220;Options.&amp;#8221; My laptop is now quite minimal. I&amp;#8217;ve even done away with window decorations entirely.&lt;/li&gt;
	&lt;li&gt;I&amp;#8217;ve been listening to Harry Potter audiobooks on my iPhone while I drive around. Although I&amp;#8217;ve read the books, it&amp;#8217;s always nice to hear them read by a talented and British person like Stephen Fry. Also, the stories are quite good.&lt;/li&gt;
	&lt;li&gt;I&amp;#8217;ve been reviewing for the GRE. This sounds boring and tedious (and it is) but it&amp;#8217;s also quite fun. It&amp;#8217;s simple and straightforward, quite unlike the tests I&amp;#8217;d become used to preparing for while at school.&lt;/li&gt;
&lt;/ul&gt;
And finally, on the most interesting note (I think), a friend and I have been aspiring to do a robotic project together. Our goal is a self-driving toy car with only a single camera input. He&amp;#8217;s managed to acquire one of those old &lt;a title="Tyco Rebound Google Images result" href="http://images.google.com/images?hl=en&amp;lt;/p&amp;gt;%20&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;" target="_blank"&gt;&lt;/a&gt;</description><link>http://blog.sagarpandya.com/post/313285227</link><guid>http://blog.sagarpandya.com/post/313285227</guid><pubDate>Sat, 02 Jan 2010 11:37:46 -0800</pubDate></item><item><title>About</title><description>&lt;p&gt;This is my attempt at a blog. I hold a very new BS degree in Computer Engineering from UCSB, complete with that new degree smell everyone loves. As you might have predicted, my interests include Linux, programming, hardware design, and science of all kinds. You can follow me (up to a point) on &lt;a title="Follow me!" href="http://www.twitter.com/sagargp" target="_blank"&gt;Twitter&lt;/a&gt;, see my &lt;a href="http://www.facebook.com/sagargp" target="_blank"&gt;Facebook&lt;/a&gt;, or view my &lt;a href="http://delicious.com/sagargp" target="_blank"&gt;bookmarks&lt;/a&gt;.&lt;/p&gt;</description><link>http://blog.sagarpandya.com/post/313285172</link><guid>http://blog.sagarpandya.com/post/313285172</guid><pubDate>Sat, 02 Jan 2010 11:37:43 -0800</pubDate></item><item><title>Push notification hack</title><description>&lt;p&gt;There&amp;#8217;s an app in the iPhone app store called &lt;a title="Prowl" href="http://prowl.weks.net/" target="_blank"&gt;Prowl&lt;/a&gt; which is like a Growl client for the iPhone. For those of you who don&amp;#8217;t know, &lt;a href="http://growl.info/" target="_blank"&gt;Growl&lt;/a&gt; is a program for Mac OSX (and Windows too, apparently) that pops up notifications on your screen about various things of interest. Most Mac apps that wish to notify you of something probably use Growl. For example, your IM program can pop up a notification when your buddies sign on, or you can get a notification when you receive new emails. Prowl is an iPhone app (and a Growl plugin) that uses the iPhone push service to push your computer&amp;#8217;s Growls to your iPhone. Well, that sounds pretty cool, right? But why do I care? I don&amp;#8217;t have a Mac, or even a Windows computer. Well, it turns out that the guy behind Prowl is pretty cool, and has made a public API available for use by anyone! Of course, I set to work hacking something similar to a Growl push service for Ubuntu.  Ubuntu (and Gnome in general) doesn&amp;#8217;t have Growl, but it has something very similar. Libnotify is a library that pops up unobtrusive notifications on a Gnome desktop in the same way that Growl does on Mac. Other programs can cause libnotify to display a notification by making a request over the &lt;a href="http://www.freedesktop.org/wiki/Software/dbus" target="_blank"&gt;d-bus&lt;/a&gt;. D-bus is a nifty inter-process communication framework for Linux. Someone cleverly wrote a Python wrapper around the Prowl API, and of course there are d-bus bindings for Python too. So it&amp;#8217;s just a matter of detecting the &amp;#8220;notify&amp;#8221; message on the bus, and then pushing the bubble&amp;#8217;s data to your iPhone using the Prowl API! It should be noted that for this to work, bus eavesdropping has to be enabled in /etc/dbus-1/session.conf (on Ubuntu). Also, I&amp;#8217;m using mail-notification on Ubuntu. This is a little app that sits in your panel and notifies you when you get a new email. Anyway, I couldn&amp;#8217;t find examples of how to do this anywhere, so I ended up reading the source for dbus-monitor to see how it does it. Then I hacked together this little script:&lt;/p&gt;
&lt;pre class="prettyprint lang-python"&gt;#!/usr/bin/python
import sys
import dbus
import gobject
import prowlpy
import lxml.html
from dbus.mainloop.glib import DBusGMainLoop

apikey = 'PROWL_API_KEY'
p = prowlpy.Prowl(apikey)

def handler(*args):
	a = args[1].get_args_list()
	if len(a) &amp;gt; 0:
		if a[0] == 'Mail Notification':
			n_data = a[4]
			n_data = lxml.html.fromstring(n_data)
			n_list = n_data.text_content().split('\n')
			print 'New email! Pushing it to phone...',
			try:
				p.add(n_list[0].split(':')[1], n_list[1].split(':')[1], n_list[2].split(':')[1])
				print 'Success!'
			except Exception, msg:
				print msg

DBusGMainLoop(set_as_default=True)

bus = dbus.SessionBus()
bus.add_match_string_non_blocking('type=method_call')
bus.add_message_filter(handler)

loop = gobject.MainLoop()
loop.run()
&lt;/pre&gt;</description><link>http://blog.sagarpandya.com/post/313285211</link><guid>http://blog.sagarpandya.com/post/313285211</guid><pubDate>Sat, 02 Jan 2010 11:37:00 -0800</pubDate></item><item><title>Dropbox and automatic scripts</title><description>&lt;p&gt;A few days ago I upgraded to Ubuntu 9.10. While at work, I needed to SSH to my home computer, but I had forgotten to install SSH server. I happened to be renewing my love for &lt;a title="Get Dropbox!" href="http://www.getdropbox.com" target="_blank"&gt;Dropbox&lt;/a&gt; at the time and I decided to write a program that would monitor a Dropbox directory on my computer for scripts, and execute them. That way I can run arbitrary commands remotely, even if I forgot to install SSH. There are obvious security problems with this, so I&amp;#8217;ve tried to skirt around them by requiring that each script be cryptographically signed by me. Ultimately, I wrote the code as a shell script instead of a Python script or other program, because it was a lot faster and easier. You can download the script &lt;a title="dropWatch.sh" href="http://blog.sagarpandya.com/wp-content/uploads/2009/11/dropWatch.sh" target="_blank"&gt;here&lt;/a&gt;. Make sure to change your GPG key ID on line 62. If you spot any bugs or errors, please let me know!  To use this script, just run it with the full path to the directory to be watched. Scripts have to be tar&amp;#8217;d along with their signature into a file called &lt;i&gt;scriptname.dbox&lt;/i&gt;. Optionally, you can also include a file called &amp;#8220;hostname&amp;#8221; which should contain the hostname of the machine that you want to execute the script on (in case you are running this on multiple computers, but only want the script to execute on one of them). Here&amp;#8217;s an example, assuming you want to execute the script &lt;i&gt;myscript.sh&lt;/i&gt; on the computer &lt;i&gt;grindelwald.&lt;/i&gt;&lt;/p&gt;
&lt;pre&gt;$ gpg --detatch-sign myscript.sh
$ echo grindelwald &amp;gt; hostname
$ tar cf myscript.dbox myscript.sh myscript.sh.sig hostname
$ mv myscript.dbox ~/Dropbox/Scripts
&lt;/pre&gt;</description><link>http://blog.sagarpandya.com/post/313285303</link><guid>http://blog.sagarpandya.com/post/313285303</guid><pubDate>Sun, 01 Nov 2009 05:17:00 -0800</pubDate><category>hax</category><category>linux</category><category>scripting</category><category>Dropbox</category></item><item><title>360</title><description>&lt;p&gt;I think I&amp;#8217;m going pack up my XBox 360, or take it to work. We used to have one there, but someone took it back home. Without it, we&amp;#8217;ve resorted to juggling during our break times. Lame, or awesome? If I don&amp;#8217;t pack it up or move it, it&amp;#8217;s just going to tempt me. I&amp;#8217;ve tried limiting myself to only playing on the weekends, but not after 11:00pm. That worked fine, but I feel like I shouldn&amp;#8217;t even play at all on the weekends. Not for a while. So I&amp;#8217;m thinking of taking it to work until I&amp;#8217;m done with GREs or applications or something. Just 2-3 months or so, really. I&amp;#8217;m pretty possessive of my stuff though. I take care of my things to a neurotic degree. For example, I clean my laptop regularly. Not everyone at work shares this behavior. So I&amp;#8217;m kind of worried about taking my XBox there. I know all it will do is sit around on a table and occasionally be turned on, but I&amp;#8217;m still a little concerned. Oh well, I&amp;#8217;m sure it&amp;#8217;ll be fine.&lt;/p&gt;</description><link>http://blog.sagarpandya.com/post/313285192</link><guid>http://blog.sagarpandya.com/post/313285192</guid><pubDate>Tue, 18 Aug 2009 01:08:00 -0700</pubDate><category>halo</category><category>work</category><category>xbox</category></item><item><title>Hello world!</title><description>&lt;p&gt;Ah I finally did something about making a blog. I have been wanting to for a while. The problem was that I never realistically expected myself to post to a blog consistently. When I went to India this summer, I wanted to record my experiences somehow. I thought that I should start small with a Twitter account (&lt;a href="http://www.twitter.com/sagargp" target="_blank"&gt;here&lt;/a&gt;). After all, Twitter is just a micro-blogging service. Well, that didn&amp;#8217;t really go as planned. I posted semi-regularly at first, and then not so much. And I&amp;#8217;ve hardly posted on it since getting back. I guess I don&amp;#8217;t see the novelty any more. In any case, I figured I&amp;#8217;d just jump in and start blogging now that a &lt;a href="http://www.iamrenato.com" target="_blank"&gt;friendly character&lt;/a&gt; told me that I can use his hosting service with my dusty old domain name which was just lying around unused. Here I hope to record the little projects that I do, and my thoughts about larger projects. I&amp;#8217;ll probably also post about other things in my life as they come to me.&lt;/p&gt;</description><link>http://blog.sagarpandya.com/post/313285144</link><guid>http://blog.sagarpandya.com/post/313285144</guid><pubDate>Sun, 16 Aug 2009 19:27:00 -0700</pubDate></item></channel></rss>

