Last active
February 16, 2016 04:13
-
-
Save ericlagergren/e745597c16600ad211c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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