Skip to content

Instantly share code, notes, and snippets.

View Just1Number's full-sized avatar

Johannes Wolf Just1Number

View GitHub Profile
@bdwakefield
bdwakefield / dscovr.ps1
Created February 5, 2016 04:11 — forked from IJMacD/dscovr.ps1
Windows Powershell Script to download the latest image from the DSCOVR satellite then set as the desktop background.
#
# DSCOVR:EPIC Downloader
#
#
#
# This script will scrape the latest image from the DSCOVR satellite, saving it
# in My Pictures\DSCOVR\ and then set as the desktop background.
#
# http://epic.gsfc.nasa.gov/
#
@quinncomendant
quinncomendant / dscovr-epic-desktop
Last active September 13, 2018 22:14
This is an OS X command-line script that downloads the latest DSCOVR:EPIC <http://epic.gsfc.nasa.gov/> image and sets it as your desktop picture. Prerequisites: requires installing Homebrew <http://brew.sh/> and then the jshon tool (`brew install jshon`). Then you can run the command manually, or add it to your crontab.
#!/usr/bin/env bash
download_directory="$HOME/Desktop/_dl/epic-earth";
apiurl="http://epic.gsfc.nasa.gov/api/images.php";
curl -s "$apiurl" | jshon -a -e image -u | while read image; do
destfile="$download_directory/$image.jpg";
mkdir -p "$download_directory";
if [[ -n "$image" && ! -f "$destfile" ]]; then
echo "New 🌍 ! $image.jpg";
curl -so "$destfile" "http://epic.gsfc.nasa.gov/epic-archive/jpg/$image.jpg";
ln -sf "$destfile" "$download_directory/latest.jpg";