A few days ago there was a story on HackerNews about a guy who made a funky script to take a photo of himself every time he opened his computer. The original story was here.
I immediately liked the idea, but wanted to do something more with it. The only natural step was to take a photo and instead of storing it locally, just uploading it to some url and tweeting it. So last night I sat down for an hour of hacking and patched together a bunch of scripts and voila #TweetAWakeup was born.
You can view the photos live on twitter via the #TweetAWakeup hashtag.
If you want to make something like this, here’s a quick howto of as many steps as I remember. I guess someone could make a simple script to do this, but then it would lose some of its geeky appeal.
Ok here’s what you do:
- Register an app on Twitter.
- Get an imgur API key
- Install Sleepwatcher
- Install iSight CLI Image Capture
- Download and install twurl (you might have to update RubyGems with “gem update –system”)
- Download my helper scripts
- Authorize twurl as per instructions on github (twurl authorize …)
- run “sudo launchctl load -w /Library/LaunchDaemons/de.bernhard-baehr.sleepwatcher-20compatibility-localuser.plist” (this makes sleepwatcher work)
- Edit ~/.wakeup and make it look something like this, obviously you should modify the path to suit your setup
#!/bin/bash /bin/bash ~/Documents/random-coding/TweetAWakeup/TweetAWakeup.sh
- Go into TweetAWakeup/update.py and edit line 8 to match your imgur API key from step 2
- Go into TweetAWakeup/TweetAWakeup.sh and edit the paths to suit your setup
- You can change what the tweet will look like on line 6 … would be nice if you leave the hashtag 🙂
- Run “twurl alias tweet /1/statuses/update.xml”
And you’re done! Every time your mac wakes up from sleep it will take a photo with iSight, then wait 10 seconds and post it on twitter. The wait is there to give your computer supple time to connect to an internet.
Obviously this whole thing is rather pointless, but I find it interesting. Maybe something awesome falls out over time and I get a neato introspection into my daily life … or better yet, a hawt sexy girl with no top will forget about this and accidentally post her boobies all over the internet then much funs will ensue.
PS: hopefully I didn’t miss a step 🙂
Learned something new? Want to improve your skills?
Join over 10,000 engineers just like you already improving their skills!
Here's how it works 👇
PS: You should also follow me on twitter 👉 here.
It's where I go to shoot the shit about programming.