Skip to content

Instantly share code, notes, and snippets.

View gsinclair's full-sized avatar

Gavin Sinclair gsinclair

  • Sydney, Australia
View GitHub Profile
@gsinclair
gsinclair / class-log.md
Last active March 5, 2026 22:05
Classroom log

2026 Year 11 Extension 1 Mathematics (Sinclair)

Fri 6 Mar

  • Comment: Yesterday and today, we have learned about graphical inequalities in general, quadratic inequalities in particular, and sketching polynomials based on their factored form. We know about intercepts, bounces and kinks.
  • Textbook work: See Classroom for "Cambridge 10B" (on graphing polynomials). We will do this instead of MiF 7.05–6.
  • Textbook work: 4.09 for quadratic inequalities
  • Further comment: We still have not learned "equivalent polynomials" (Example 9 in the textbook), so you can't do 7.03 Q15. Some other questions in 7.03 are likely to be intimidating as well; we'll get to them. Apart from that, I'd hope that all of 7.01–7.04 are accessible to you now. Next week we will consolidate our knowledge of polynomials and get ready to attack the final exercise (7.07 – sums and products of zeroes).

Mon 2 Mar

  • Comment: We started Polynomials today. It is an Extension subject and is included in your first
@gsinclair
gsinclair / wezterm.lua
Created December 23, 2024 04:53
A WezTerm config for Mac which is opinionated but has a small surface area.
local wezterm = require('wezterm')
local act = wezterm.action
local c = wezterm.config_builder()
--
-- General settings: reload config, close confirmation, key encoding
--
c.automatically_reload_config = true
Name,Sex,Age,Height (in),Weight (lbs)
Alex,M,41,74,170
Bert,M,42,68,166
Carl,M,32,70,155
Dave,M,39,72,167
Elly,F,30,66,124
Fran,F,33,66,115
Gwen,F,26,64,121
Hank,M,30,71,158
Ivan,M,53,72,175
# We read the data as just an array of words. No need for line-by-line, although
# that is fine as well.
def test_data_09():
return open("data/09.1.txt").read().split()
def real_data_09():
return open("data/09.txt").read().split()
D = test_data_09()
;; Problem 13 from Advent of Code 2021 -- origami
(defn fold-left [fold-x [x y :as point]]
(if (< x fold-x)
point
[(- (* 2 fold-x) x) y]))
(defn fold-up [fold-y [x y :as point]]
(if (< y fold-y)
point

Karabiner layouts for symbols and navigation

Gavin Sinclair, January 2022

Introduction

I use Karabiner (configured with Gosu) to make advanced key mappings on my Apple computer. Karabiner allows you to create “layers”, perhaps simulating those on a programmable mechanical keyboard. I make good use of these layers to give me easy access (home-row or nearby) to all symbols and navigational controls, and even a numpad.

The motivation is to keep hand movement to a minimum. Decades of coding on standard keyboards has unfortunately left me with hand and wrist pain. I will soon enough own a small split keyboard which will force me to use layers to access symbols etc., so this Karabiner solution, which has evolved over months, is a training run for that.

@gsinclair
gsinclair / karabiner-example.edn
Created January 10, 2022 10:25
A Karabiner/Goku example that among other things demonstrates swapping Win and Alt keys on an external keyboard to reflect the Mac Option-Command layout.
{
:devices {
:sculpt-keyboard [{:product_id 1957 :vendor_id 1118}]
}
:layers {:capslock-mode {:key :caps_lock :alone {:key :escape}}
; CAPSLOCK gives arrow keys with hjkl and Enter with m or Escape if tapped
}
@gsinclair
gsinclair / links.txt
Last active September 13, 2021 00:41
@gsinclair
gsinclair / guessing.py
Created February 18, 2021 01:19
Computer guessing game
import random
UPPER_LIMIT = 1000000
target = random.randint(1, UPPER_LIMIT)
print("I've chosen a number between 1 and", UPPER_LIMIT)
num_guesses = 0
while True:
# --- Question 1 ------------------------------------------- #
# Return the number of jumps required to get to zero.
def light_years(n):
return 0
def test_light_years(n):
assert light_years(10) == 4
assert light_years(11) == 4