Skip to content

Instantly share code, notes, and snippets.

@ericlagergren
Last active February 16, 2016 04:13
Show Gist options
  • Save ericlagergren/e745597c16600ad211c8 to your computer and use it in GitHub Desktop.
Save ericlagergren/e745597c16600ad211c8 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
import requests
import os
import random
import string
import time
def rand_name():
return "/tmp/" + ''.join(random.SystemRandom().choice(string.ascii_uppercase + string.digits) for _ in range(15)) + ".jpg"
def get_bg():
while True:
name = rand_name()
resp = requests.get("https://source.unsplash.com/random")
with open(name, "wb") as imag:
imag.write(resp.content)
os.system("feh --bg-fill " + name)
time.sleep(900)
if __name__ == "__main__":
get_bg()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment