This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Watch Mastodon stream for notifications and blink Thingy52 | |
''' | |
import asyncio | |
import os | |
import ssl | |
try: | |
import certifi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from argparse import ArgumentParser | |
from time import sleep | |
try: | |
import twitter | |
except: | |
print('Requires python-twitter: pip install python-twitter') | |
exit(1) | |
api = twitter.Api( | |
consumer_key='...', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
try: | |
from twitter import Api | |
import twitter | |
except: | |
print('Requires python-twitter: pip install python-twitter') | |
exit(1) | |
api = Api( | |
consumer_key='...', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
try: | |
from twitter import Api | |
except: | |
print('Requires python-twitter: pip install python-twitter') | |
exit(1) | |
api = Api( | |
consumer_key='CONSUMER_KEY_HERE', | |
consumer_secret='CONSUMER_SECRET_HERE', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import zipfile | |
from io import BytesIO | |
async def handler(r, w): | |
line = await r.readline() | |
try: | |
method, path, version = line.split(b' ', 2) | |
except: | |
w.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
import zipfile | |
from io import BytesIO | |
async def handler(r, w): | |
line = await r.readline() | |
try: | |
method, path, version = line.split(b' ', 2) | |
except: | |
w.close() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
# next client id | |
client = 1 | |
async def handler(r, w): | |
line = await r.readline() | |
try: | |
method, path, version = line.split(b' ', 2) | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Defaults: | |
// Bw = 125 kHz | |
// Cr = 4/5 | |
// Sf = 128chips/symbol | |
// CRC on | |
RH_RF95::ModemConfig modem = {0x72, 0x74, 0x00}; | |
void setBandwidth(uint32_t bw) { | |
uint8_t index; | |
uint32_t bandwidths[] = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import network | |
import web | |
import uasyncio as asyncio | |
CLIENTS = set() | |
# access point credentials | |
AP_SSID = 'SSE AP' | |
AP_PASSWORD = 'donthackmebro' | |
AP_AUTHMODE = network.AUTH_WPA_WPA2_PSK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from socket import create_connection | |
from ssl import create_default_context | |
def run_test(addr, path, httpversion): | |
host, port = addr | |
ctx = create_default_context() | |
with create_connection(addr) as s: | |
with ctx.wrap_socket(s, server_hostname=host) as ss: | |
ss.send(b'GET %s %s\r\n' % ( | |
path.encode('utf8'), |
NewerOlder