PhysCon! (and life update)

So this September I started college. It’s been an awesome experience so far, but one of the best parts was an opportunity recently that I was able to take advantage of. Every four years Sigma Pi Sigma and the Society of Physics Students holds the Quadrennial Physics Congress, or PhysCon for short. Through my college’s physics club (which I’m a part of), I was able to attend for a very low price. The entire experience was amazing, from the travel, to being able to meet Nobel laureates. One of my favorite parts was actually the poster session, where students would present posters that showed off research they had done with different universities and professors. It really inspired me to become involved in research at my college. All in all I had an incredible experience, and would readily recommend it to anyone who has an interest in physics.

New domain name

I finally bit the bullet and bought myself a real domain name, instead of using the (albeit excellent) noip.com service. After much internal debate, I settled on ivoah.net. This newfound power also allows me to set up subdomains, something that wasn’t possible before (at least I don’t think so). So far I don’t actually have any subdomains set up, except for rick.ivoah.net (guess what that is :P). I plan to set up a pi.ivoah.net which will (obviously) be served from a raspberry pi, or maybe even chip.ivoah.net, which would come off of my C.H.I.P. computer I recently received. I have also taken the opportunity to set up https with let’s encrypt, a free service for issuing certificates.

Get iTunes artwork in Python

While thinking of uses for my tiny 128×128 TFT, I thought it would be cute if it showed the currently playing iTunes artwork. Little did I know the rabbit hole it would lead me down. Surely I thought somebody else had wanted to get the currently playing iTunes artwork from within python, I mean, it seems pretty tame compared to other atrocicities I’ve witnessed. But alas, my (albeit fairly short-lived) google searching revealed nothing, save some outdated StackOverflow questions. One thing it did turn up however, was ScriptingBridge, Apple’s python module to allow a python script interact with other OS X applications. I found a snippet of code to get the object for the currently playing song in iTunes, and took over from there. After much poking and probing (thank goodness for dir()), I found what I needed, a TIFF representation of the artwork for the currently playing song in iTunes. Using the magic of PIL (or Pillow in my case) it was trivial to convert this into a workable format for my needs. There is still one road-block, and that would be that it seems to cause a memory leak. After running the TFT script for a little over 30 minutes, the script had managed to consume 42 gigabytes of memory (that’s RAM, not disk space folks), before locking up my entire computer. I was alerted to the issue by OS X kindly telling me that I had run out of disk space on my startup disk, the paging file was massive. Anyways, I’m sure somebody more well versed in the intracies of ScriptingBridge would be able to locate the issue and take care of it. Please leave a comment if you know what’s wrong 🙂

from PIL import Image
from cStringIO import StringIO
from ScriptingBridge import *

iTunes = SBApplication.applicationWithBundleIdentifier_("com.apple.iTunes")

img = Image.open(StringIO(iTunes.currentTrack().artworks().firstObject().rawData()))

MATE on Raspberry Pi

Recently(ish), I wanted to get the MATE desktop running on my Raspberry Pi. I personally think it looks much better than LXDE, and I didn’t really need the extra performance of LXDE. As with most Debian/Raspbian stuff, it was just a matter of finding the right packages to install. You’ll want to sudo apt-get install mate-desktop-environment xinit. mate-desktop-environment is (obviously) for the MATE desktop, while xinit provides the startx command.

DNS magic

Before my old server died and I had to start over, I would have to access it via http://debby.local (debby was its hostname) when at home on the same network as it, and http://codinghobbit.no-ip.org when elsewhere. This wouldn’t have been much of an issue, except WordPress has the annoying “feature” where all links are absolute, i.e. http://codinghobbit.no-ip.org/link/to/stuff instead of /link/to/stuff. I had to install a plugin to convert all absolute URLs to relative URLs, and it worked okay. Another annoyance was that when giving people links to pages on my site, I would have to change the debby.local to codinghobbit.no-ip.org and vice-versa when clicking links to my site from other places. With the change of server, I figured it was time to fix the issue and do things right. First, I just added an entry to the hosts file on my laptop, which worked fine, but only for that computer. I wanted a more general solution that would work for anything connected to the network. I set up my little server to also act as a DNS server using dnsmasq, which reads the hosts file and uses that as it’s configuration. I then set the servers main and primary DNS to be 8.8.8.8 and 8.8.4.4, google’s DNS servers. The next step was to set the router to use my server as it’s DNS server, instead of whatever the ISP provided. Once I had everything set up, it all worked perfectly. Now I can use the same address no matter where I’m connecting from, and WordPress’s absolute URLs work fine.

EDIT: While this worked fine for codinghobbit.no-ip.org, where I didn’t have any subdomains, it doesn’t work now as I want to be able to add subdomains and such to my site. I now have just added address=/ivoah.net/192.168.1.32 to my dnsmasq.conf, which works beautifully

My blog is back

So, you may have noticed (or not, since nobody really reads this) that my blog died a few months ago. This was due to my trusty iMac G3 that had been powering my humble site finally kicking the bucket after around 16 years of service (not all to me). Luckily, I had my Mac Mini that I no longer used, so I loaded Debian 8 up on it and went on my way. Unfortunately, along with the iMac the hard drive that my site was on died also. Thankfully, archive.org had copy of my most important blog post (How to install Debian on a TI-Nspire) on their Wayback Machine. I set up a new blog using AnchorCMS, but didn’t like it very much. It stayed around for a while, because I was too lazy to change back to WordPress. Yesterday, I decided I had had enough of Anchor and switched to WordPress, and made a few other enhancements to the site (mostly benefiting myself for easier dev). In order to keep old links to the Nspire post working, I manually edited the ID number of the post, so it matched what it was on my old blog. If you read all this, thanks for taking your time, and please post a comment telling me that I’m not just shouting into an empty internet. I might post what I did with DNS stuff to make things easier on myself in a few days.