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
import imaplib
import email
#connect to gmail
mail = imaplib.IMAP4_SSL('imap.gmail.com')
mail.login('[email protected]','yourPassWordPlease')
mail.select('inbox')
mail.list()
@vwillcox
vwillcox / gertboard-wind-led.py
Last active January 2, 2016 04:09
Read from PYWWS Weather raw file and display the wind speed as a range of LEDs on the GertBoard
#!/usr/bin/env python2.7
# Python to read pywws raw weather-file and output windspeed
# To the GertBoard LED's based on strength
from collections import deque
import csv
import wiringpi
from time import sleep
import sys
import math
@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
@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
#!/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}
#!/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()
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()
@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
@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 / 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