Monthly Archives: September 2012

Twitter Auto Delete

Despite me making a clean break from Twitter earlier this year, I’ve ended up back on it on a casual basis, mostly due to the number of my friends on there who only chat or are only reachable via it. :-(

I decided that this time I’d like to treat Twitter more like an IRC chat room, ie a place to chat casually with friends, but not as a formal permanent record – so I made some tweaks to how I was using it:

  1. Primary interaction with Twitter is via PrplTwtr, a plugin for Pidgin, which makes Twitter act like any other chat room, to avoid the habit of having Twitter open in my browser being an invasive distraction. If friends @reply me or DM me, I get a new IM message notification, but otherwise I can ignore it happily.
  2. I wrote a small script that automatically goes and deletes all my Twitter messages after 24 hours – this is enough time for me to chat comfortably with friends, but makes it hard for outsiders to go and data mine my feed and it’s less of a permanent recordable cached record, or link to my tweets long term.

It’s not a perfect setup, whilst it prevents someone from casually going back and seeing my history and engagements with others, it doesn’t stop someone recording my tweets over an extended period to build up their own data pool about me, and of course I have no way of knowing if when I delete a tweet, if it really disappears from the pool of information that Twitter sells to data miners to use.

But it’s good enough that I can chat with friends and keep up-to-date with their lives without leaving a huge digital footprint for any randoms to trawl through.

There are some auto-deleter services around, but I didn’t trust any of them to not do malicious things with my account (eg spamming their presence), plus I wanted it to delete all my tweets *except* my blog post feed.

I found that there’s a pretty decent Twitter module for Python and decided to use this as an exercise to finally learn some proper Python, something I’ve somewhat avoided for lack of a good learning exercise.

The result is a simple Twitter auto-deleter script that is called by Cron every 4 hours and runs a check and deletes any tweets older than 24 hours – the basics is pretty simple really:

39    # query my user status list
40    mytimeline = api.GetUserTimeline(screen_name=user_name,count=query_quantity,include_rts=True)
41    
42    for status in mytimeline:
43    
44        if re.match("^New Blog Post", status.text):
45            #print "Blog post! No delete wanted"
46            continue
47    
48        if status.created_at_in_seconds < cond_time_before:
49            api.DestroyStatus(status.id)
50       
51            print "Deleting Tweet:"
52            print "- Created At: " + status.created_at
53            print "- Content: " + status.text

Note that with GetUserTimeline, you need to specify include_rts=True as an explicit option, so that it includes anything you’ve retweeted in the timeline returned.

Favorites are special wee critters and require a separate GetFavorites call, I don’t use Favorites, so wanted this delete to remove any favorites created by accidental miss-clicks.

You can check out my source here – if you want to run it on your own server, you’ll need to use your account to setup a dev API key and access tokens etc. And you may want to adjust things like the deletion of favorites or retention of blog posts.

I’ve pondered turning this into a simple web-hosted service for people to use, so if you’re the sort of person who can’t use this script yourself but would like the ability to auto-delete your tweets, let me know and I’ll ponder doing it if there’s interest.

I’m sure Twitter will probably kill off more and more of these API calls in future, but at the moment they’re exposing just enough logic to enable me to do this. :-)

Do note that if you run this on a big account, you will hit the maximum API call limit VERY quickly, hence a configured query quantity limit to restrict how many tweets are loaded per execution – you could get away with several hundred every 60mins if you wanted to delete all your twitter history as fast as possible without actually blowing away the account.

Whirlwind Month

Since I left Auckland at the end of August, it’s been a pretty hectic month, with flights all over the place and adventures in Wellington, Hastings, Melbourne and Sydney!

After we left Auckland, Lisa and I enjoyed a relaxed week in Wellington just spending time catching up with friends, having coffee, beer and just basically having a week of holiday.

Wellington wanders <3

After a week in Wellington, we drove up to Hawke’s Bay for one last road trip in my trusty Toyota Starlet and spent the weekend with Lisa’s family, before I departed leaving her there, so that I could spend two weeks in Wellington tidying up affairs down there, whilst Lisa worked on tidying up and reducing the amount of stuff she had stored at her parents place.

Spending so long apart really sucks, but we both needed to do so in order to get stuff done, and there’s just not enough space at my parents place for us to stay for much longer than one night.

I ended up managing to sell off my beloved Toyota Starlet and a number of other items including my gaming computer, lots of computer cables, software, old flat stuff and other bits and pieces – it’s amazing how much stuff you collect over time, but I’ve managed to get it down so that I have two suitcases plus one cubboard at my parents place only – essentially only storing anything that will have use once I return to NZ in a couple of years.

After packing two suitcases, I flew out of Wellington on the 15th of September on a one-way ticket to start my AU adventure!

Kitty wants to come too!

I arrived in Melbourne looking for work and managed to spend a few days there doing job interviews, getting some basics like my bank accounts and cellphone sorted out and generally tripping around a new city and trying not to freak out at the fact that I’ve just moved country and in a single step changed EVERYTHING in my daily life.

I ended up booking and staying at the Miami Hotel, a 3.5 star place out in West Melbourne near a friends house, since I wanted a bit of my own space – it’s somewhere I’d happily recommend to anyone traveling on a budget, thanks to it’s around $90 a night

Thankfully I do have a number of friends in Melbourne, plus some Twitter friends I had not yet met in person, who helped take me around the place and to get some new sights.

It’s not a hipster bar, until you sit on crates drinking organic beer and watching a DJ in baggy pants wearing a cap with ears designed to look like a horse re-mix popular tracks.

Melbourne CBD, from up on Rooftop Bar

More Melbourne!

There’s no better introduction to Melbourne than starting my first day by visiting a hipster bar, followed by a rooftop bar looking out over the city and catching up with all my Melbourne Twitter friends. :-)

I also spent some time wandering the Victoria Markets, huge amount of stalls and fresh produce – even a meat hall which my friends had great delight dragging me into. :-/

Fluffy kittens! And a fuzzy kitten adventure tube!

I did a lot of walking whilst in Melbourne, I was staying up in West Melbourne, so ended up walking through the CBD almost daily and getting a feel of the city and learning new places.

Tanqueray tram, just for @pikelet

Trams! Tower blocks! Melbourne!

The Yarra river – I personally wouldn’t go swimming in it any time soon, looks a bit murky. :-/

Rain clouds moving into the city.

Misty walking bridge.

I also ended up training and tramming around the city lots, the transport system in Melbourne is amazing, so rapid and easy to get around, I got across town in about 15mins by jumping on a train, then a tram and using the Android Tram Hunter and Train Tracker applications to check schedules and routes.

Woot, trains!

Melbourne at night, when coming out of Flinder’s Station

It’s a pretty amazing city – it took me a few days to get settled a bit more, but keen to spend a lot more time there.

Sadly my plans to get work there were interrupted, I had only been in Melbourne for a few days before I got the sad news that my grandfather in Wellington has been diagnosed with terminal cancer and has less than 4 weeks to live. :-(

I decided to take the time to fly back to NZ sooner rather than later, so that I could spend some time with him whilst I still can, so booked a flight back to Wellington at short notice – sadly this meant that I had to pass on a couple interesting opportunities that had arisen, but I guess there’s never really a good time for this sort of thing to happen.

After having booked my return flight, I then got a call at short notice from a contract recruiter, who had a position for a 3-month contract in Sydney for a Linux engineer – I managed to re-arrange my travel plans, and instead of flying directly back to Wellington, ended up flying into Sydney, spending a day there to interview and then flying back to Wellington from there.

Doesn’t get much more iconic than the Sydney Harbor Bridge. Unlike Auckland, they were actually smart enough to put rail, walk and cycle crossings on it.

Circular Quay Panorama

Sydney CBD from the botanical gardens down by the opera house.

Sydney CBD viewed from Pyrmont.

I will have to make some time to actually go on and explore these awesome machines – looks like it’s possible to actually go and tour inside the submarine!

Fuck yeah Monorail!

After all this crazy tripping around Melbourne and Sydney, I flew back to Wellington for a few days to spend time with family and then flew to Hawke’s Bay to spend time with Lisa.

Meanwhile the job interview in Sydney returned good results, so this weekend, Lisa and I fly to Sydney to start my new 3-month contract in Sydney from the 1st of October!

Going to be a lot of fun and will offer some new challenges in a whole new city, 3 months will give us a chance to sample Sydney and figure out if we want to stay there for longer term, or we can shift to Melbourne at a later stage.

Android OpenVPN & Jelly Bean

Last night my Galaxy Nexus finally got the Jelly Bean update pushed to it via Over-The-Air – I’m not sure why it’s taken until now to get it, but ICS has been working fine so I never bothered to build Android from source again.

It was slightly disturbing that the update came down over 3G data, whilst I have a fair bit of cap, a lot of NZders are on pretty low cellphone datacaps and the update is around 160MB.

The upgrade was pretty seamless, however it broke my Openvpn for Android setup, preventing me from connecting to any of my servers or email. According to the application, there is a known issue that when the OS updates, you need to re-establish the trust relationship with the Android keystore, which you can do by editing the VPN and re-selecting the certificate and selecting “allow”.

Unfortunately, that didn’t work for me, it would keep repeating the error and refusing to run.  There wasn’t much useful in adb logcat either:

I/ActivityManager(  303): Displayed de.blinkt.openvpn/.MainActivity: +213ms
I/ActivityManager(  303): START {act=android.intent.action.MAIN cmp=de.blinkt.openvpn/.LaunchVPN (has extras) u=0} from pid 4071
I/ActivityManager(  303): START {flg=0x20000 cmp=de.blinkt.openvpn/.LogWindow u=0} from pid 4071
I/keystore(  130): uid: 1000 action: t -> 1 state: 1 -> 1 retry: 4
I/keystore(  130): uid: 1000 action: x -> 1 state: 1 -> 1 retry: 4
V/OpenSSL-keystore( 4071): keystore_bind_fn
V/OpenSSL-keystore( 4071): keystore_engine_setup
V/OpenSSL-keystore( 4071): keystore_loadkey(0x5c30c3d0, "1000_USRPKEY_mobile-jethro", 0x0, 0x0)
I/keystore(  130): uid: 10067 action: b -> 7 state: 1 -> 1 retry: 4
W/keystore_client( 4071): Error from keystore: 7
V/OpenSSL-keystore( 4071): Cannot get public key for 1000_USRPKEY_mobile-jethro

I had a read and came across this bug report in Android, suggesting that the names of some certificates could be a problem.

My certificate was mobile-jethro.p12, so I named it to mobile.p12 and imported it again – which resolved the problem! Bit of a nasty character handling bug it seems….

RS232 Shifter Board

As part of my project to make an Arduino based watchdog for my home server, I went and picked up a proper soldering iron today and assembled the RS232 Shifter Circuit I had purchased from Sparkfun/Mindkits.

I ended up getting a Goot soldering iron – it wasn’t too cheap, but the reviews I was reading online suggested it was the next best thing to a proper soldering station and a quality Japanese tool. It’s also 46W, so much better for the lead-free solder I’m using, compared to the crappy 15W DSE brand generic iron I was using previously.

Tool of the gods.

It made a massive difference to the soldering efforts, the lead-free solder melted without issue and flowed smoothly – plus the fine point conical tip made getting the solder into key areas a lot easier.

The tips are changeable and I’ve been advised by an electronics fixing friend to get a set of tip types, as certain ones suit different tasks better than others.

Whilst the new soldering iron is a huge improvement, my soldering skill is still a bit poor, I had a few text-book joins where the solder flowed perfectly and bonded with a smooth shiny surface, but a lot of my joins tend to be slightly one sided, where the solder hasn’t flowed right around the components lead and PCB hole which makes then a bit weak.

I’m also tending to leave too much solder on the component lead, which leaves larger joins than really needed, so need to work on how much solder I apply.

Parents, avert your children’s eyes from this soldering monstrosity!

On the flip side, the top looks great ;-)

After constructing the circuit, I gave it a test by connecting the TX and RX of the shifter circuit to the TX and RX on the Arduino, which basically uses the Arduino as an UART to RS232(over USB) adapter.

Then I connected the new DB9 port to my laptop and typed messages into the Arduino serial monitor, to have them passed through my new circuit and into my laptop’s DB9 port.

Amazingly, things worked first time and I’m able to successfully receive data via the shifter board – in my quick test TX from the shifter board wasn’t working, but it may have been a serial speed/config issue that I just need to tweak in the OS, rather than the board itself.

Arduino IDE to Minicom via an Arduino, my new shifter circuit and my laptop’s USB to RS232 adapter.

The next step is connecting this shifter circuit to the digital I/O ports on the Arduino and using the software serial library to add a second serial port to the device. I can then do the same to the HTC Magic serial break out and I’ll basically have an Arduno with 3 serial ports in total –  the onboard UART, the DB9 PC via shifter and the HTC magic.

Once that’s done, it’s just a case of writing the software needed to turn the collection of hacks into a hardware watchdog and serial remote access system. :-)

And once that’s all working, I’ll build a final solution using one of the Arduino prototyping shields from Freetronics, which will include all the shifter circuitry onboard and just provide a 2×5 IEC pin header to plug a ribbon cable directly into the server’s motherboard serial port header.

Escape from Auckland!

We finally managed to complete the move out last weekend! I don’t know how we managed to collect so much stuff in just 11 months, but we managed to fill my Starlet and an entire van with all Lisa’s stuff…

Broken down the office, next few weeks is living on the laptop only.

When boxing up all my stuff I realized that most of this is going into storage or being sold, very little that I’ll actually be taking with me to AU.

Most important part of the flat ;-) Sadly this will be staying in NZ rather than coming with us due to the size of it :-(

Books add so much weight. :-( There’s not a lot that I want to take – going to look at getting something like a Kindle for future books, but at the same time, there are things like code references or coffee tables books I really want to take. :-(

Sitting inside on outdoor furniture is all class. ;-)

It’s Mac World! They managed to escape my presence without getting Linux installed on them…. this time. ;-)

This is about half the stuff loaded into the van…

Had a pretty good drive down to Wellington, but of course it now means that I have to go through all my stuff and finish selling off things on Trademe, I don’t really want to end up storing lots of stuff at my parents place, particularly since any computer equipment would be obsoleted within a few years.

Also selling off my trusty Toyota Starlet and pretty much anything computer related that isn’t my laptop or my server, so keep watching my TradeMe listings over the next couple of weeks.

Next stop: Melbourne! I’m flying over on the 15th of September with the aim of lining up some work, with Lisa following me over as soon as I get something signed and a flat sorted.