Skip to content

Instantly share code, notes, and snippets.

@kanru
Created July 9, 2012 02:51
Show Gist options
  • Save kanru/3073933 to your computer and use it in GitHub Desktop.
Save kanru/3073933 to your computer and use it in GitHub Desktop.
Use NASA / NationalGeographic IOTD as background wallpaper
#!/bin/bash
# grabs the nasa image of the day by RSS feed and updates the gnome
# background. add this to your cron jobs to have this happen daily. this is,
# obviously, a hack, that is likely to break at the slightest change of NASA's
# RSS implementation. yay standards!
#EDITED FOR feh
rss=`wget -q -O - http://www.nasa.gov/rss/lg_image_of_the_day.rss`
img_url=`echo $rss | grep -o '<enclosure [^>]*>' | grep -o 'http://[^\"]*'`
img_name=`echo $img_url | grep -o [^/]*\.\w*$`
# this command is benign if the directory already exists.
mkdir -p $HOME/.cache/backgrounds
# this command will overwrite the image if it already exists
wget -q -O $HOME/.cache/backgrounds/$img_name $img_url
feh --bg-fill $HOME/.cache/backgrounds/$img_name
#!/bin/bash
rss=`wget -q -O - http://photography.nationalgeographic.com/photography/photo-of-the-day/`
img_url=`echo $rss | grep -o '<div class="download_link"><a[^>]*>'| grep -o 'http://[^\"]*'`
img_name=`echo $img_url | grep -o [^/]*\.\w*$`
# this command is benign if the directory already exists.
mkdir -p $HOME/.cache/backgrounds
# this command will overwrite the image if it already exists
wget -q -O $HOME/.cache/backgrounds/$img_name $img_url
feh --bg-fill $HOME/.cache/backgrounds/$img_name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment