Skip to content

Instantly share code, notes, and snippets.

View ncke's full-sized avatar

Nick Everitt ncke

  • London, UK
View GitHub Profile
@ncke
ncke / heat.py
Last active March 17, 2023 19:31
Async Heat Equation
# Copyright (c) 2023 AUTHORS
#
# SPDX-License-Identifier: BSL-1.0
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
from typing import Optional, Tuple
from threading import Thread
from queue import Queue
import numpy as np
import sys
@ncke
ncke / WeakMultiMap.swift
Created February 19, 2023 10:55
A dictionary-like Swift actor that holds an array of weak references for each key.
//
// WeakMultiMap.swift
// Created by Nick on 19/02/2023.
//
import Combine
import Foundation
// MARK: - Weak Multi Map
@ncke
ncke / Xixo.swift
Created May 27, 2021 11:10
Implements a thread-safe generic data structure that can behave as a stack or a queue.
import Foundation
/**
Implements a thread-safe generic data structure that can behave as a
stack or a queue.
*/
struct Xixo<Element> {
enum Mode {
/** Stack mode provides a lifo data structure. */