Skip to content

Instantly share code, notes, and snippets.

View andypiper's full-sized avatar
🔨
Fixing code things with finger hammers.

Andy Piper andypiper

🔨
Fixing code things with finger hammers.
View GitHub Profile
@andypiper
andypiper / tooter.py
Created November 15, 2022 11:54
Post a Toot from MicroPython
import network
import urequests
import ujson
# do_connect()
mast_url="https://mastodon.social"
token=MY_MASTODON_TOKEN
# note: this *must* include content-type
@andypiper
andypiper / followers.py
Created November 10, 2022 22:38
Mastodon code scribbles
from mastodon import Mastodon
mast = Mastodon(client_id='key',client_secret='secret',access_token='token',api_base_url='https://mastodon.social')
me = mast.me()
print(f"Followers: {me.followers_count}")
@andypiper
andypiper / flask-ap-scheduler.py
Created November 2, 2022 13:13
Schedule a task in a Flask app
# useful https://stackoverflow.com/questions/21214270/how-to-schedule-a-function-to-run-every-hour-on-flask
# docs https://pypi.org/project/Flask-APScheduler/
from flask import Flask
from flask_apscheduler import APScheduler
app = Flask(__name__)
scheduler = APScheduler()
def scheduleTask():
@andypiper
andypiper / tweepy-notes.md
Created August 17, 2022 10:36
Tweepy cheatsheet / Twitter API v2

BEARER = "my-long-token"

Check/delete stream rules

import tweepy

client = tweepy.StreamingClient(BEARER)

client.get_rules()
@andypiper
andypiper / Setup.md
Created August 9, 2022 20:32
MicroPython UNIX port on iPad

You'll need to install iSH

Then...

echo https://dl-cdn.alpinelinux.org/alpine/v3.16/main > /etc/apk/repositories
echo https://dl-cdn.alpinelinux.org/alpine/v3.16/community >> /etc/apk/repositories
apk upgrade
apk add micropython --repository=http://dl-cdn.alpinelinux.org/alpine/edge/testing
@andypiper
andypiper / andypiper-ld+json.json
Last active March 27, 2024 12:02
My JSON-LD Person object
{
"@context": "http://schema.org/",
"@type": "Person",
"name": "Andy Piper",
"affiliation": [
{
"@type": "Organization",
"name": "Games at Work dot Biz",
"sameAs": [
"https://botsin.space/@gamesatwork_biz",
@andypiper
andypiper / key-light-mini-api.md
Last active April 20, 2022 18:38
Key Light Mini
  • [ip]:[port]/elgato/accessory-info
  • [ip]:[port]/elgato/battery-info
  • [ip]:[port]/elgato/lights
  • [ip]:[port]/elgato/lights/settings

GET /elgato/accessory-info

@andypiper
andypiper / rc2014.md
Created April 12, 2022 21:26 — forked from jblang/rc2014.md
RC2014 Links
@andypiper
andypiper / temp-check.py
Created March 21, 2022 14:18 — forked from lesp/temp-check.py
Using a BME688 Temperature sensor with Pimoroni's Badger 2040. Code is based on the BME688 example, but with added Badger 2040 code.
"""BME688 / BME680 demo
This demo will work for both the BME680 and BME688.
"""
import time
from breakout_bme68x import BreakoutBME68X, STATUS_HEATER_STABLE
from pimoroni_i2c import PimoroniI2C
import badger2040
import machine
badger = badger2040.Badger2040()
@andypiper
andypiper / api-presentation-links.txt
Created January 28, 2022 10:40
Some Twitter API v2 links