Skip to content

Instantly share code, notes, and snippets.

Robert Smallshire rob-smallshire

Block or report user

Report or block rob-smallshire

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rob-smallshire
rob-smallshire / roundedcube.scad
Created Jan 25, 2020 — forked from groovenectar/roundedcube.scad
roundedcube.scad - Fork me and make me better!
View roundedcube.scad
// More information: https://danielupshaw.com/openscad-rounded-corners/
// Set to 0.01 for higher definition curves (renders slower)
$fs = 0.15;
module roundedcube(size = [1, 1, 1], center = false, radius = 0.5, apply_to = "all") {
// If single value, convert to [x, y, z] vector
size = (size[0] == undef) ? [size, size, size] : size;
translate_min = radius;
@rob-smallshire
rob-smallshire / temperature.py
Last active Aug 22, 2019
Dynamic temperature types in Python
View temperature.py
import operator
ABSOLUTE_ZERO = 0
class Temperature:
_scale_classes = {}
_promotion_rules = {}
@classmethod
View wordlist.txt
acrobat africa alaska albert albino album
alcohol alex alpha amadeus amanda amazon
america analog animal antenna antonio apollo
april aroma artist aspirin athlete atlas
banana bandit banjo bikini bingo bonus
camera canada carbon casino catalog cinema
citizen cobra comet compact complex context
credit critic crystal culture david delta
dialog diploma doctor domino dragon drama
extra fabric final focus forum galaxy
@rob-smallshire
rob-smallshire / diffusion.py
Created Sep 22, 2017
Diffusion Limited Aggregation - solution to Exercise 4d in Sixty North's Boost.Python workshop
View diffusion.py
# Diffusion limited aggregation simulation
# as an example solution to Sixty North's
# Boost.Python workshop.
#
# Usage:
#
# python diffusion.py 128 128 4096 diffusion.bmp
#
# To produce a 128x128 image with 4096 sticky
# 'grains' diffused into it.
@rob-smallshire
rob-smallshire / macOS-in-virtualbox.md
Last active Feb 4, 2020
Notes on getting macOS Sierra running in Virtualbox on a Windows 10 host
View macOS-in-virtualbox.md

On Mac

Download, but don't run, the Sierra installer from the Mac App Store. This places the installer at /Applications/Install\ macOS\ Sierra.app/.

Now run the following commands to build a suitable VM image from the installer:

git clone https://github.com/jonanh/osx-vm-templates
cd osx-vm-templates/packer
sudo ../prepare_iso/prepare_vdi.sh -D DISABLE_REMOTE_MANAGEMENT -o macOS_10.12.vdi /Applications/Install\ macOS\ Sierra.app/ .
@rob-smallshire
rob-smallshire / class_decorators.py
Created Mar 18, 2017
Multiple class decorators
View class_decorators.py
from abc import ABC, abstractmethod
import functools
def invariant(predicate):
"""Create a class decorator which checks a class invariant.
Args:
predicate: A callable to which, after every method invocation,
the object on which the method was called will be passed.
@rob-smallshire
rob-smallshire / palindrome.py
Last active May 20, 2016
The longest palindromic primes of n-digits reproducing the first part of an integer sequence seen in a mural at Oslo Gardermoen airport
View palindrome.py
# The longest palindromic primes of n-digits
# reproducing the first part of an integer
# sequence seen in a mural at Oslo Gardermoen
# airport
from urllib.request import urlopen
def main():
with urlopen('https://oeis.org/A002385/b002385.txt') as response:
@rob-smallshire
rob-smallshire / scanner.ino
Created Oct 23, 2015
Arduino sketch for a slide scanner using a GAF 503 slide projector and a Canon 20D camera
View scanner.ino
int NUM_SLIDES = 50;
// Pin 2 has a slide projector connected
int PROJECTOR_ADVANCE_PIN = 2;
int CAMERA_FOCUS_PIN = 3;
int CAMERA_SHUTTER_PIN = 4;
int ARDUINO_LED_PIN = 13;
// the setup routine runs once when you press reset:
@rob-smallshire
rob-smallshire / invariant.py
Created May 18, 2015
A decorator for checking that class invariants are established and maintained.
View invariant.py
import functools
def invariant(predicate):
"""Create a class decorator which checks a class invariant.
Args:
predicate: A callable to which, after every method invocation,
the object on which the method was called will be passed.
The predicate should evaluate to True if the class invariant
View bisecting_planes.py
@classmethod
def bisecting_planes(cls, p, q):
"""Determine the bisector of two planes.
Args:
p, q: The two planes to be bisected.
Returns:
The plane bisecting planes p and q.
You can’t perform that action at this time.