Skip to content

Instantly share code, notes, and snippets.

@wolandark
Created June 9, 2024 17:08
Show Gist options
  • Save wolandark/92ba2784b94a5e6ba2c8ec7464dbec4c to your computer and use it in GitHub Desktop.
Save wolandark/92ba2784b94a5e6ba2c8ec7464dbec4c to your computer and use it in GitHub Desktop.
grabs the latest xkcd comic and displays it with sixel graphics
#!/usr/bin/env bash
# xkcdsh
# info:
# grabs the latest xkcd comic and displays it with sixel graphics
# Written By Wolandark
# https://www.github.com/wolandark
# Dependency:
# libsixel
# curl
# GNU sed
# GNU Grep
curl -s https://xkcd.com | grep -oP '(?<=<img src="//imgs.xkcd.com/comics/)[^"]*' | \
sed 's/^/https:\/\/imgs.xkcd.com\/comics\//' | \
while read -r url; do
filename=$(basename "$url")
curl -so "$filename" "$url" && img2sixel "$filename"
printf '%s\n' "$filename"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment