Skip to content

Instantly share code, notes, and snippets.

View pvanallen's full-sized avatar

Philip van Allen pvanallen

View GitHub Profile
@pvanallen
pvanallen / detect.py
Last active December 18, 2023 08:47
RPI5 object detection with MediaPipe
# Copyright 2023 The MediaPipe Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@pvanallen
pvanallen / buxton-sketch-to-prototype-continuum.csv
Created November 20, 2019 21:59
buxton-sketch-to-prototype-continuum
Sketch Prototype
Invite Attend
Suggest Describe
Explore Refine
Question Answer
Propose Test
Provoke Resolve
Tentative, non committal Specific Depiction
@pvanallen
pvanallen / critical-prototyping.csv
Last active November 20, 2019 21:43
critical prototyping table
A (conventional design) B (Dunne & Raby) C (ritical prototyping)
Affirmative Critical Propositional
Problem solving Problem finding Problem setting
Provides answers Asks questions Discovers questions
Design for production Design for debate Design for inquiry
Design as solution Design as medium Design as practice
In the service of industry In the service of society In the service of design
Fictional functions Functional fictions Exploratory fictions
For how the world is For how the world could be What is the world?
Change the world to suit us Change us to suit the world Change design to suit a context
from bs4 import BeautifulSoup
import requests
# Open and read the template file
fo = open("template.html", "r")
html_template = fo.read();
fo.close()
# get the webpage
r = requests.get("http://www.nytimes.com")
<html>
<head>
<title>My Scraped NYT Page</title>
</head>
<body>
<p class="title"><b>The Scraped Data from NYT</b></p>
<p>{0}</p>
<img src="{1}">
from bs4 import BeautifulSoup
import requests
# get the webpage
r = requests.get("http://www.nytimes.com")
# get the HTML source from that page
html_doc = r.text
# turn the source into a bs4 "soup" object
# these examples assume that the bs4_example.py code has already been run
# https://gist.github.com/pvanallen/0e07e3d24c9885f30d45a2b515a18600#file-bs4_example-py
#
# paste each of these lines, one at a time, into the python command line
# to see the result
soup.title
# 1
# <title>The Dormouse's story</title>
from bs4 import BeautifulSoup
html_doc = """
<html><head><title>The Dormouse's story</title></head>
<body>
<p class="title"><b>The Dormouse's story</b></p>
<p class="story">Once upon a time there were three little sisters; and their names were
<a href="http://example.com/elsie" class="sister" id="link1">Elsie</a>,
<a href="http://example.com/lacie" class="sister" id="link2">Lacie</a> and
import random
adjectives = ["angry","bewildered","clumsy","defeated","embarrassed","fierce","grumpy","helpless","itchy","jealous","lazy","mysterious","nervous","obnoxious","panicky","repulsive","scary","thoughtless","uptight","worried","agreeable","brave","calm","delightful","eager","faithful","gentle","happy","jolly","kind","lively","nice","obedient","proud","relieved","silly","thankful","victorious","witty","zealous"]
verbs = ["add","allow","bake","bang","call","chase","damage","drop","end","escape","fasten","fix","gather","grab","hang","hug","imagine","itch","jog","jump","kick","knit","land","lock","march","mix","name","notice","obey","open","pass","promise","question","reach","rinse","scatter","stay","talk","turn","untie","use","vanish","visit","walk","work","yawn","yell","zip","zoom"]
nouns = ["apple","arm","banana","bike","bird","book","chin","clam","class","clover","club","corn","crayon","crow","crown","crowd","crib","desk","dime","dirt","dress","fang ","field","flag","flower","fog","game","heat","hil
<html>
<head>
<title>Make a sentence</title>
</head>
<body>
<p class="title"><b>The new sentence</b></p>
<p>{0} is a {1} {2} that can {3} a {4}</p>
</body>