Skip to content

Instantly share code, notes, and snippets.

Wesley Archer raspberrycoulis

Block or report user

Report or block raspberrycoulis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@raspberrycoulis
raspberrycoulis / twitter-follower-bot.py
Created Mar 9, 2017
Python script to check your Twitter followers and send you a Slack notification of how many this is.
View twitter-follower-bot.py
#!/usr/bin/python
import tweepy
import urllib2
import time
# For Twitter: Add the relevant keys, tokens and secrets from your Twitter app made here: https://apps.twitter.com/
consumer_key = ''
consumer_secret = ''
@raspberrycoulis
raspberrycoulis / Pi-lluminate.md
Last active Mar 7, 2018
Using the Enviro pHAT to calculate the average lux in the room, and turn on some lights if it gets too dark
View Pi-lluminate.md

Pi-lluminate the room

This is an attempt at a Python script to make use of Pimoroni's Enviro pHAT to calculate the average light level (lux) in a room, and to trigger an action if the lux drops below a pre-determined threshold (in this case, send a webhook command to turn on some Philips Hue lights).

Enviro pHAT average lux calculation

I "borrowed" some of the code used in Pimoroni's BME680 Breakout Board to calculate the average lux level. The idea being that the Enviro pHAT captures the lux for 15 seconds, then calculates the average reading that is then used to trigger the action.

Webhooks

For simplicity, I'm using IFTTT's Maker channel to use webhooks. These webhooks link to an IFTTT applet that triggers a Philips Hue bulb at home based on the parameters passed.

@raspberrycoulis
raspberrycoulis / cpu.py
Last active Jul 7, 2017
Display CPU usage on Pimoroni's Scroll pHAT HD
View cpu.py
#!/usr/bin/env python
import sys
import time
try:
import psutil
except ImportError:
sys.exit("This script requires the psutil module\nInstall with: sudo pip install psutil")
View mote_api.py
from colorsys import hsv_to_rgb, rgb_to_hsv
import motephat
from flask import Flask, jsonify, make_response
app = Flask(__name__)
motephat.configure_channel(1, 16, False)
motephat.configure_channel(2, 16, False)
motephat.configure_channel(3, 16, False)
motephat.configure_channel(4, 16, False)
@raspberrycoulis
raspberrycoulis / blinkt-followers.py
Created Mar 15, 2017
Python script that checks Instagram and flashes Pimoroni's Blinkt if the follower count has increased
View blinkt-followers.py
#!/usr/bin/python
import urllib2
from urllib import quote
import time
import json
from config import (
ig_style,
ig_account,
ig_access_token,
@raspberrycoulis
raspberrycoulis / twitter.py
Created Mar 10, 2017
Raspberry Pi Twitter Follower Bot Python script
View twitter.py
#!/usr/bin/python
import tweepy
import urllib2
import time
# For Twitter: Add the relevant keys, tokens and secrets from your Twitter app made here: https://apps.twitter.com/
consumer_key = ''
consumer_secret = ''
@raspberrycoulis
raspberrycoulis / facebook.py
Created Mar 10, 2017
Raspberry Pi Facebook Fan Bot Python script
View facebook.py
#!/usr/bin/python
import urllib2
from urllib import quote
import json
# Variables - configure the bits below to get your script working.
style = '#3b5998' # Colour for the message - default is Facebook blue
fb_page = '' # Facebook Page name
You can’t perform that action at this time.