Skip to content

Instantly share code, notes, and snippets.

@george-hawkins
george-hawkins / serial_tester.py
Created March 2, 2024 15:33
Code accompanying function call overhead question on MicroPython forums
import argparse
import statistics
import time
import zlib
import serial
TIMESTAMP_BYTE_COUNT = 8
CRC_BYTE_COUNT = 4
@george-hawkins
george-hawkins / yield-example.py
Created February 25, 2024 14:29
Working with `yield` in Python
def foo():
for i in range(0, 16):
print(f"> {i}")
j = yield i
print(f"> {j}")
yield j
print(f"* 1")
gen = foo()
@george-hawkins
george-hawkins / README.md
Last active January 27, 2024 15:05
Forcing GitHub to reindex your repos

Forcing GitHub to reindex your repos

Apparently, GitHub stops indexing repos that have not had a commit for over a year. They say this is to ensure that search limits itself to providing the most relevant results.

But this is a pain if you know your own repos contain some particular information but GitHub turns up no search results because of this constraint.

A way to force a reindex of a repo is to search it - you may get no results but GitHub will put the repo in a queue to be reindexed and in about 5 minutes the same search may produce a result if the repo contains the relevant term.

However, if you don't know the relevant repo and want to search all your repos, it's somewhat inconvenient to have to manually search them all to force a reindex.

pyenv update
pyenv install -l
pyenv install 3.10.8
pyenv global 3.10.8

Show CUDA version:

Green screen: is paint mixing not a thing at US hardware stores?

Is paint mixing not a common service at US hardware stores? An odd question to ask on Blender Artists.

I've been experimenting with mixing live footage with scenes created in Blender. As part of this, I wanted to try chroma keying. I looked up the color usually used for green screens. Most people seem to agree that it's Pantone 354 C.

If you try to buy green screen paint, you'll find it's quite expensive, e.g. ROSCO Chroma Key costs around US$100 per gallon (~3.8L).

As this is quite a lot, you can find many blog posts, etc. where people have compared standard hardware store paints to find something cheaper. A popular winner is Disney Gamma Sector Green (apparently available from Home Depot).

package com.example
import java.time.{Duration, ZonedDateTime}
trait Customer
trait Priority
trait OvenState
trait Cooker {
def cook(customer: Customer, deliveryTime: ZonedDateTime, priority: Priority): Boolean
@george-hawkins
george-hawkins / 0-README.md
Created July 8, 2021 20:42
Diffuse bake with only color selected still results in different colors

1 2 3 4 5...

@george-hawkins
george-hawkins / 0-README.md
Last active July 8, 2021 14:43
Constraining area in which select similar acts?

Constraining area in which select similar acts?

Can I constrain the area over which select similar acts? In the model shown below, I wanted to select the blue faces on the underside of the model. I could do this with selecting similar by normal (and upping the threshold value until I got all faces I wanted), however this selected all faces that met the similarity condition, not just those on the underside of my model.

I could do select similar and then flip to a front view and control drag to unselect everything above the ground layer. This almost gets me to where I want to be.

However, I was wondering if there was a better way? This approach of unselecting things requires the ground layer to be perfectly flat to work well. What I really want (I think) is to be able to constrain select similar to just those faces I can see when looking at the underside.

Ignoring the normals and instead using select linked with flat faces (with the angle upped suitably) alm

I wouldn't bother with shebangs in your Python files (or with making them exectuble, i.e. using chmod on them).

Instead, I'd create a bash script (with shebang) to orchestrate things. E.g. something like this:

#!/bin/bash

symbol=$1
start=$2