Skip to content

Instantly share code, notes, and snippets.

View vwillcox's full-sized avatar
🏠
Working from home

Vincent Willcox vwillcox

🏠
Working from home
View GitHub Profile
@vwillcox
vwillcox / nasa-windows-toast.py
Created June 5, 2019 07:15
Get Nasa AOD and set as a Windows desktop image, also send a notification with image title and description. Thanks to Big Les (https://bigl.es/tooling-tuesday-nasa-api-and-python/)
import os
import requests
import ctypes
from win10toast import ToastNotifier
url = "https://api.nasa.gov/planetary/apod?api_key="
os.environ['NO_PROXY'] = 'nasa.gov'
r = requests.get(url)
toaster = ToastNotifier()
@vwillcox
vwillcox / nasa-windows-toast.py
Last active June 5, 2019 07:10
Get Nasa's Image of the Day, set it as a background on Windows 10 and push a notification. Special thanks to Les Pounder for the original code
import os
import requests
import ctypes
from win10toast import ToastNotifier
url = "https://api.nasa.gov/planetary/apod?api_key="
os.environ['NO_PROXY'] = 'nasa.gov'
r = requests.get(url)
toaster = ToastNotifier()
@vwillcox
vwillcox / Tesco1.py
Created January 7, 2019 22:09
Tesco.com Product Grocery Search API Python3 quick demo script
########### Python 3.2 #############
import http.client, urllib.request, urllib.parse, urllib.error, base64, json, jsonify
import sys, getopt
def main(argv):
query = ''
offset = 0
limit = 10
@vwillcox
vwillcox / EnviroPhatandScrollPhatHD.py
Created October 28, 2018 21:30
Take the LUX level and room temp from an Enviro Phat and show the room temp on a Scroll Phat HD
#!/usr/bin/env python
import time
import numpy as np
import subprocess
from envirophat import weather, leds, light
import scrollphathd as sphd
from scrollphathd.fonts import font3x5
sphd.clear()
@vwillcox
vwillcox / veho.py
Last active October 23, 2018 18:17
#!/usr/bin/python3
import sys, getopt
import tikteck
def connecttoBulb(b):
bulb = tikteck.tikteck(b, "Smart Light", "[PASSWORD]")
bulb.connect()
return bulb
import requests
from bs4 import BeautifulSoup
response = requests.get('http://www.tesco.com/groceries/en-GB/search?query=blueberry')
soup = BeautifulSoup(response.text, 'html.parser')
for item in soup.select('.product-list--list-item'):
try:
product = item.find(class_='product-image').get('alt', '')
value = item.find(class_='value').get_text()
#!/usr/bin/env python
import time
import unicornhat as unicorn
import urllib
unicorn.set_layout(unicorn.AUTO)
unicorn.rotation(0)
unicorn.brightness(0.5)
width,height=unicorn.get_shape()
#!/usr/bin/env python2
from envirophat import weather
import time, os, sys, urllib, urllib2
THINGSPEAKKEY = 'ENTERYOURAPIKEY'
THINGSPEAKURL = 'https://api.thingspeak.com/update'
def sendData(url, key, field1, field2, temp, pres):
values ={'api_key' : key, 'field1' : temp, 'field2' : pres}
@vwillcox
vwillcox / pijuice-charge.py
Created June 6, 2018 17:29
Python script to show Charge of attached PiJuice module on a SchollPhat
#!/usr/bin/env python
import math
import sys
import time
import scrollphat
import json
from pijuice import PiJuice # Import pijuice module
@vwillcox
vwillcox / scan4pi.py
Last active September 17, 2017 21:26
#! /usr/bin/python
# Python3 code to print IP addresses and host name of local network
# to e-ink screen
import nmap
import sys
import socket
from gpiozero import RGBLED, Button
import smbus