Update Twitter from your iPhone via the command line
This guide assumes you have a jailbroken iPhone or iPod Touch with MobileTerminal installed.
I have Twitterific on my iPhone, it’s a nice app but I’m using my iPhone on Orange and they are quite tight when it comes to decent internet access. I wanted to be able to update my Twitter feed without downloading all of the feeds that I follow. Answer: use wget to send an update.
As I didn’t want to have to type the lengthy wget command every time I set up a shell script to do this for me. Make sure you are in /var/mobile and then open nano with nano twitter-update.sh
Type in the following script:
#! /bin/sh
read -p "What are you doing?" -e tweet
wget -q http://twitter.com/statuses/update.xml --http-user=email --http-password=password --post-data="status=$tweet" >/dev/null
echo "Done"
You need to change email and password to your Twitter login details. Save and close the file.
Next open your .bashrc file with nano and add an alias to save you typing ./twitter-update.sh. Mine looks like this:
alias t='./twitter-update.sh'
Again save and close the file. Reload your .bashrc file with source .bashrc. That’s it. Now I can send a Twitter update by opening MobileTerminal and hitting ‘t’, then type in my tweet.
Offline WordPress released
I finally got around to releasing my script I use for toting my private WordPress notebook around on my iPod. It’s essentially a PHP page that creates a static HTML page with a load of JavaScript to selectively hide and show posts as they’re searched for.
This is my method for getting the resulting file onto my iPod. I’ve included it here in case it’s useful to someone.
Things you will need
- A jailbroken iPod/iPhone
- MobileTerminal (from Cydia)
- wget (from Cydia)
- file:// Schema in Safari (from Cydia)
Setting up the alias
Open MobileTerminal and type the following:
iPod:~ mobile$ nano .bashrc
This will either open your existing .bashrc file or create one for you in Nano.
The following command will create an alias that makes a backup of your previously downloaded export page and then downloads the latest version.
alias wp='cd; mv export.html export~.html; wget http://www.domain.com/pathtopage --output-document=export.html'
Note that if your blog is behind a password you will need to add --http-user=name and --http-password=pass to the wget part of the alias.
Now close the file by typing CTRL-O.
To make sure your .bashrc file loads when you start up your iPod you now need to create a .profile. Type the following:
iPod:~ mobile$ nano .profile
Then add the following to that file:
source $HOME/.bashrc
Close the file by typing CTRL-O.
Now any time you want to download your WP data just load up MobileTerminal and type wp. To load your offline page in Safari you need go to the URL file:///var/mobile/export.html.