If you have an Ubuntu box, you can use a script to to set your wallpaper's to Elon's Latest Tweet.elon_tweet.sh
Here is how you setup:
- Install required packages.
- Download tweet.sh - an OAuth based twitter client implemented completely as a bash script.
- Get Token keys for from your Twitter account and save it in the config file. You need this for OAuth that twee.sh uses.
- Get a free account on http://www.page2images.com/ and fetch your API keys. This service allows you to generate screenshot of any supplied URL - you can use this service to to fetch PNGs's of Elon's tweets. We do screenshots because aren't just interested in tweet's text but also any images that Elon chooses to attach with his tweets.
- In the batch script (elon_tweet.sh) appended below, configure the pages2images API key
- Setup the batch script (elon_tweet.sh) as a cron job which runs once every minute.
You can set this script up on a Raspberry Pi running Raspbian connected to your TV as well. Its always nice to have some inspiration trickling in while you work.
|Here is how my desktop looks like|
Here's how to go about putting the pieces together:
- Open a terminal window and install the required software on your ubuntu box:
sudo apt-get install jq imagemagick pngcrush nkf
- Clone https://github.com/piroor/tweet.sh and place tweet.sh and tweet.client.key in your home directory
- While logged into Twitter, visit https://apps.twitter.com/ and create a new app and generate the required Token and Keys and place them in tweet.client.key
- Mark tweet.sh as executable:
sudo chmod +x tweet.sh
- Register on http://www.page2images.com/ and get your API key
- Create a new script called elon_tweet.sh in your home folder and copy and paste the code snippet appended below.
- Edit elon_tweet.sh and insert the pages2image API key at the appropriate location.
- Mark elon_tweet.sh as executable:
- Set the script to run once every minute:
and insert the following line:
* * * * * bash ~/elon_tweet.sh
The script will run once every minute and will check if there is any new tweet from Elon since last check. If there is, it will submit the URL for screenshot generation and exit. When the script is run again at the next consecutive minute, it will fetch the image, crop it and set it up as wallpaper. If Elon has put up a new tweet, the URL of this new tweet is submitted for screenshot and the script exits. In such situation, you will miss out the 2nd tweet if the time difference between 1st and 3rd tweet is less than 2 minutes - this can be fixed in the script, but it seemed to be a bit much. Thank God Elon doesn't go crazy on twitter. All the tweets are saved in the Pictures folder.
|Tweet screenshots are saved in Pictures folder|