I just wanted to harvest tweets over a period of about a month or two, but I didn’t want to pay for all that processor time on an EC2 instance. I tried running my Python script on my shared hosting account, but the admins kept killing the ‘screen’ containing it. I would have used my desktop computer, but I can’t sleep with it on. And my laptop couldn’t provide the uptime I needed.
First thought: Raspberry Pi. But getting one looked like a rather lengthy process, and I didn’t want to have to wait weeks or months to proceed with my project.
I happened to have a 2nd generation iPod Touch running iOS 4.2.1 that was just collecting dust. After trying and failing to get Linux on it, after wrangling with Darwin and reading walkthroughs, I’m ready to share the steps that eventually got me there. Hopefully they’ll help you.
How I did it (minus the dead ends and false starts)
- Downloaded the latest version of Redsn0w.
- Downloaded the iPod Touch 2G 4.2.1 firmware. (Thanks to k1ttyrain for the file.)
- Ran Redsn0w and went through the jailbreak process.
- Used Cydia to install OpenSSH, wget, BerkeleyDB, and SQLite 3. (I also installed screen so I could run my script and leave it running after ending my SSH session, but you don’t have to.)
- SSHed into my iPod.
- Changed my root password with passwd.
dpkg -i python_2.7.2-5_iphoneos-arm.deb
wget --no-check-certificate https://github.com/pypa/virtualenv/raw/develop/virtualenv.py
python virtualenv.py env
At that point I used the copy of pip in the env/bin directory that virtualenv created to install the modules I needed and used the copy of python in the same env/bin directory to run my script in a screen I detached. Now I’ve got a quiet little iPod Touch plugged into the wall, slurping down tweets and saving them into date-stamped files!
Edit: Added mention of SQLite 3 and BerkeleyDB in step four.