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 / weather2.py
Last active December 2, 2023 18:52
A Threaded weather and clock display for the #Pimoroni #GlacticUnicorn
import urequests as requests
import json
import network
import secrets
from picographics import PicoGraphics, DISPLAY_GALACTIC_UNICORN as DISPLAY
from galactic import GalacticUnicorn
import jpegdec, math, ntptime, time
import _thread
blink=0
@vwillcox
vwillcox / weather.py
Created February 5, 2023 12:09
Galactic Unicorn Current Weather Display
try:
import urequests as requests
except:
import requests
try:
import ujson as json
except:
import json
@vwillcox
vwillcox / mastocloud.py
Last active February 4, 2023 11:09
Quick and dirty Wordcloud tool for Mastodon Account profiles.
import requests
import json
import time, argparse
import matplotlib.pyplot as py
from wordcloud import WordCloud,STOPWORDS
from PIL import Image
import numpy as np
parser = argparse.ArgumentParser()
parser.add_argument("-a", "--account", help="Handle to use", required=True)
@vwillcox
vwillcox / main.py
Last active September 7, 2022 20:58
Scroll the current people aboard the ISS on a Raspberry Pi Pico W With a Pimoroni Unicorn Pack Attached.
# Based on
# Scroller Demo
# Kevin McAleer May 2022
# Additional code by Vincent Willcox September 2022
import network
import secrets
import time
import urequests
from scroller import Scroller
@vwillcox
vwillcox / wordcloud.py
Last active April 19, 2022 18:42
Quick and Dirty Word cloud in Python!
import tweepy
import time
import matplotlib.pyplot as py
from wordcloud import WordCloud,STOPWORDS
from PIL import Image
import numpy as np
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--twittername", help="Twitter handle to use", required=True)
@vwillcox
vwillcox / rpilocator.py
Created April 18, 2022 14:39
Show RSS feed from RPILocator RSS - simple display
from bs4 import BeautifulSoup
import requests
import re
headers = {
'User-Agent': 'your-user-agent-here'
}
class ReadRss:
@vwillcox
vwillcox / speedtest_pg_h_round.py
Created February 16, 2022 19:35
A quick gauge showing the percent complete of a speedtest..net speed test running on a Raspberry Pi on a HyperPixel Round Display.
import subprocess
import json
import sys
import time
import pygame
import pygame.gfxdraw
import math
from pygame.locals import *
class Gauge:
@vwillcox
vwillcox / speedtest2.py
Created January 7, 2022 20:38
Speedtest.net Python
import subprocess
import json
import sys
import time
proc = subprocess.Popen(['/home/pi/speedtest -p -f json'], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
for i in proc.stdout:
output = proc.stdout.readline()
@vwillcox
vwillcox / speedtest.py
Last active April 26, 2020 19:49
Quick Python3 wrapper around the official Ookla Speedtest CLI
import subprocess
import json
stdoutdata = subprocess.getoutput("speedtest -f json")
#print(stdoutdata.split()[0])
results = json.loads(stdoutdata)
for key in results:
download = results["download"]["bandwidth"]
upload = results["upload"]["bandwidth"]
@vwillcox
vwillcox / nasa-windows-toast-and-caption.py
Created June 5, 2019 08:30
Take the Nasa AOD. add a sprinkling of Toast and a Pillow and you have a script that changes your desktop daily and adds the caption to the bottom. Thanks to : https://bigl.es/tooling-tuesday-nasa-api-and-python/
import os
import requests
import ctypes
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
from win10toast import ToastNotifier
url = "https://api.nasa.gov/planetary/apod?api_key="
os.environ['NO_PROXY'] = 'nasa.gov'