Skip to content

Instantly share code, notes, and snippets.

@chrismdp
Last active December 28, 2015 17:17
Show Gist options
  • Select an option

  • Save chrismdp/f3073b1e2756d5106a98 to your computer and use it in GitHub Desktop.

Select an option

Save chrismdp/f3073b1e2756d5106a98 to your computer and use it in GitHub Desktop.

Revisions

  1. Chris Parsons revised this gist May 1, 2015. 2 changed files with 12 additions and 9 deletions.
    9 changes: 0 additions & 9 deletions -
    Original file line number Diff line number Diff line change
    @@ -1,9 +0,0 @@
    #!/bin/bash

    set -e

    index=$[ 1 + $[ RANDOM % 10 ]]
    img=`curl https://unsplash.com/rss/ | xmllint --xpath '/rss/channel/item['$index']/image/url/text()' -`
    curl "$img" > ~/unsplash-latest.jpg
    osascript -e 'tell application "iTerm" to set background image path of current session of current terminal to "'$HOME'/unsplash-latest.jpg"'

    12 changes: 12 additions & 0 deletions unsplash.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/bin/bash
    # NOTE: requires ImageMagick
    # NOTE: will tint to the Solarized Dark default background scheme, as the iTerm background blend option didn't lower the contrast enough for me
    # NOTE: Optimised for a 1280x800 point screen (my 13" Retina MBP)

    set -e

    index=$[ 1 + $[ RANDOM % 10 ]]
    img=`curl https://unsplash.com/rss/ | xmllint --xpath '/rss/channel/item['$index']/image/url/text()' -`
    curl "$img" > ~/unsplash-latest.jpg &&
    /usr/local/bin/mogrify -fill '#002833' -gaussian-blur 0x10 -resize 1280x800^ -extent 1280x800 -colorize 50% ~/unsplash-latest.jpg &&
    osascript -e 'tell application "iTerm" to set background image path of current session of current terminal to "'$HOME'/unsplash-latest.jpg"'
  2. chrismdp created this gist Apr 29, 2015.
    9 changes: 9 additions & 0 deletions -
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    #!/bin/bash

    set -e

    index=$[ 1 + $[ RANDOM % 10 ]]
    img=`curl https://unsplash.com/rss/ | xmllint --xpath '/rss/channel/item['$index']/image/url/text()' -`
    curl "$img" > ~/unsplash-latest.jpg
    osascript -e 'tell application "iTerm" to set background image path of current session of current terminal to "'$HOME'/unsplash-latest.jpg"'