Skip to content

Instantly share code, notes, and snippets.

View torrentails's full-sized avatar

Alex Sullivan torrentails

  • Perth, Western Australia
View GitHub Profile
@torrentails
torrentails / cycle_setting.py
Created October 21, 2025 03:56
Sublime text 4 cycle setting extension
import os
import sublime
from sublime_plugin import ApplicationCommand
# This is an adaption of the 'toggle_setting_ext' plugin snippet at:
# https://github.com/STealthy-and-haSTy/SublimeScraps/blob/fc2eaff26f45b7aa94fe3cadc8cbd3e15b1361d6/plugins/toggle_setting_ext.py
# Notable changes are that this version is named 'cycle_setting', and that the
# setting cycled now persists across windows, views, and reloads. Most of the
# rest is copied verbatim from the above link. Much thanks to STealthy-and-haSTy!
@torrentails
torrentails / hashed_coords.py
Created October 9, 2023 09:45
Fixed coordinate hashing algorithm concept
def get_n_primes(n: int = 100) -> list[int]:
retval = [2]
i = 3
while len(retval) < n:
if is_prime(i):
retval.append(i)
i += 2
return retval
@torrentails
torrentails / test_3_to_2_dice.py
Created May 10, 2016 01:39
Tests 2 diferent solutions to "The Three Indistinguishable Dice Puzzle" presented by Matt Parker in the video at https://youtu.be/xHh0ui5mi_E
###########################################################################################
# Testing of solutions to The Three Indistinguishable Dice Puzzle
# Copyright (C) 2016 Nathan Sullivan <contact@torrentails.com>
# This program is licened under The WTFPL available at http://www.wtfpl.net/about/
#
# The puzzle was presented by Matt Parker on his YouTube chanel, standupmaths
# https://youtu.be/xHh0ui5mi_E
#
# The first soulution here was presented by Katie and Paul here:
# https://youtu.be/Hfw8bB82-ps