Skip to content

Instantly share code, notes, and snippets.

Avatar
🥰
Awesome online fan hangout with Cindy Alexander (an amazing musician)

Andy Piper andypiper

🥰
Awesome online fan hangout with Cindy Alexander (an amazing musician)
View GitHub Profile
@andypiper
andypiper / post
Created January 2, 2023 19:32 — forked from edsu/post
View post
#!/bin/bash
# Set these environment variables and you can create a (text-only) post using
# your favorite command line text editor.
#
# - EDITOR: e.g. vim, emacs, etc
# - MASTODON_POST_HOST: the hostname for our Mastodon account, e.g. chaos.social
# - MASTODON_POST_TOKEN: an app access key with write:statuses permission
#
# See: https://gist.github.com/edsu/aa6f70bb20127b1e18e05dff5e470022
@andypiper
andypiper / tooter.py
Created November 15, 2022 11:54
Post a Toot from MicroPython
View tooter.py
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
View followers.py
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
View flask-ap-scheduler.py
# 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 / bot.py
Created October 7, 2022 13:43 — forked from Dhravya/bot.py
A simple twitter bot using Twitter API v2
View bot.py
import pytwitter
from os import environ as env
from dotenv import load_dotenv
load_dotenv() # Loads the .env file we created earlier
api = pytwitter.Api(
consumer_key=env["CONSUMER_KEY"],
consumer_secret=env["CONSUMER_SECRET"],
access_token=env["OAUTH_TOKEN"],
@andypiper
andypiper / tweepy-notes.md
Created August 17, 2022 10:36
Tweepy cheatsheet / Twitter API v2
View tweepy-notes.md

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
View Setup.md

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 January 31, 2023 16:33
My JSON-LD Person object
View andypiper-ld+json.json
{
"@context": "http://schema.org/",
"@type": "Person",
"name": "Andy Piper",
"affiliation": [
{
"@type": "Organization",
"name": "Games at Work dot Biz",
"sameAs": [
"https://twitter.com/gamesatwork_biz",
@andypiper
andypiper / key-light-mini-api.md
Last active April 20, 2022 18:38
Key Light Mini
View key-light-mini-api.md
  • [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
View rc2014.md