Skip to content

Instantly share code, notes, and snippets.

View rbricheno's full-sized avatar
🐍
_

Robert Bricheno rbricheno

🐍
_
View GitHub Profile
@rbricheno
rbricheno / tree_game.py
Last active November 27, 2023 13:37
Simon game for the pocketmoneytronics Christmas trees
# Simon game for the pocketmoneytronics Christmas trees
# By Rob!
# Public Domain and / or CC0 at your choice, share and enjoy!
import time
from time import sleep
from machine import Pin
from random import randint
game_states = {
@rbricheno
rbricheno / M5stack "buttons Test:"
Created May 24, 2021 16:28
m5stack "buttons Test:" at boot
I bought an "M5stack Core" and it didn't seem to do anything useful.
When I turned it on, it went through a routine displaying some graphics and finally a screen that said:
TF card test:
Listing directory: /
Failed to open directory
Writing file: /hello.txt
Failed to open file for writing
@rbricheno
rbricheno / gist:c5fe54bda78498f8d7deb9650bad2df0
Last active November 26, 2020 15:29
bbc-graphics-processing.js
let x;
let y;
let XM=640.1;
let ZM=800;
let YM=700;
let tilt=20;
let ST;
let CT;
let maxY;
from turtle import *
DIGITS = 1000
def pi_digits(x):
"""Generate x digits of Pi.
Nicked from https://stackoverflow.com/a/54967370/9794932"""
k,a,b,a1,b1 = 2,4,1,12,4
while x > 0:
p,q,k = k * k, 2 * k + 1, k + 1
class CountedPerson:
counter = 0
def __init__(self, name):
self.name = name
print("Registered " + name)
CountedPerson.counter += 1
print("There are " + str(CountedPerson.counter) + " people registered.")
mike = CountedPerson("Michael")
gabe = CountedPerson("Gabriel")
* {
font-family: Avenir Next, Helvetica Neue, Arial, Sans;
}
div#logo {
font-size: 18px !important;
}
div#logo img.pin_logo {
content: url("https://bitbucket.org/Scottkillen/userstyles/raw/5cf55c08325d0c28a6f840b3fa5b93679cb52549/img/pin.png") !important;
width: 16px;
height: 16px;
@namespace url(http://www.w3.org/1999/xhtml);
body {
background-color: #262626 !important;
}
/* Bright text */
td.title a:link, span.comment font, span.comment font a:link, u a:link, span.yclinks a:link, body:not([id]),
td:nth-child(2):not(.subtext) > a:link, input, textarea, p > a, a > u, .c00, .c00 a:link,
a[href="http://www.ycombinator.com/apply/"] {
color: #ccc !important;
# 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
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
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):