Skip to content

Instantly share code, notes, and snippets.

View rbricheno's full-sized avatar
🐍
_

Robert Bricheno rbricheno

🐍
_
View GitHub Profile
#!/usr/bin/env python3
from rak811 import Mode, Rak811
import time
lora = Rak811()
lora.hard_reset()
lora.mode = Mode.LoRaWan
lora.band = 'EU868'
lora.set_config(dev_eui='xxxxxxxxxxxxxxxx',
app_eui='xxxxxxxxxxxxxxxx',
from guizero import App, Text
from gpiozero import Button
button = Button(2)
app = App(title="Hello GPIO")
message = Text(app, text="Waiting for first update")
def update_button():
if button.is_pressed:
message.value = "Button is pressed"
from guizero import App, Text
from gpiozero import Button
button = Button(2)
app = App(title="Hello GPIO")
message = Text(app, text="Waiting for first update")
def pressed_button():
message.value = "Button is pressed"
/*
https://stackoverflow.com/a/53966346/9794932
https://tio.run/##TZDrToQwEIX/9ylOMG6KgqHrbc0Cibd9CeTHAkWarIUsRaubfXbsRY1Nk5n2nMl8M3Ws6nqe33vRoFK9pnW33eNMDxHqXo4K/l1VEYRUkCHIgcCcf6rWRZkhSNjy8ur65nZ1d//w@PS8CdbO@NGJHQeNY4k8QxJCD4UskdkyWlWFzHNWIs9BKUMMKhcsDJGmWJqwQKI35ZocCTkRst5NDUc6qkb0F11OiPoceMNbTHIUr5I3nmcypKs1IW6ot62Q1GZ/5E5GNbWFpTgkEZi5NrCjR3aTGm0UX7xvrdXyMC@6Fh3Xo9oXEudgBs8Jbn1eiGxNZLblS37dtl/iv4a9adLS4HR8kUH04zD24zx/Aw
*/
void btox(char *xp, const char *bb, int n)
{
#include <CayenneLPP.h>
#include <Adafruit_BME280.h>
#include "RAK811.h"
#include "SoftwareSerial.h"
#define WORK_MODE LoRaWAN // LoRaWAN or LoRaP2P
#define JOIN_MODE OTAA // OTAA or ABP
#if JOIN_MODE == OTAA
String DevEui = "xxx"; // Fill this out
String AppEui = "xxx"; // Fill this out
String AppKey = "xxx"; // Fill This out

This specification briefly describes an optional header used to negotiate evil things web sites can and can't do.

On the assumption that some people would rather simply bounce off a site that tries to do these things, and not waste time.

An additional header is specified for the client and the server.

The header looks like this:

Accept-Evil: aaaaaaa

@rbricheno
rbricheno / terminal-bbc-news
Created July 30, 2019 14:47
BBC news in the terminal
curl -s http://feeds.bbci.co.uk/news/rss.xml?edition=uk | grep '<description>' | cut -f3 -d "[" | cut -f1 -d "]"
import time
from threading import Thread
class HoldDownOrchestrator():
def __init__(self):
self.call = None
hold_down_singleton = HoldDownOrchestrator()
def hold_down(a_function, timer, *args, **kwargs):
def factorize(x):
"""Takes an integer. Returns a list of its prime factors."""
fluffy = []
boring = set()
for i in range(2, x+1):
if i not in boring:
fluffy.append(i)
boring = boring.union({j for j in range(i*i, x+1, i)})
return [tardigrade
for tardigrade
# Lets look at the "1 times table"...
table = 1
# ... up to 23
x = 23
print("Try 1 (wrong)")
for number2 in range(2,x+1):
for i in range(2,int(number2 ** 0.5)):
if (number2 % i) == 0:
break