Skip to content

Instantly share code, notes, and snippets.

import numpy as np
data = """00100
11110
10110
10111
10101
01111
00111
11100
@steven-omaha
steven-omaha / conway.py
Created November 5, 2021 13:34
conway's game of life
from types_conway import Cell, Field
NEAR = (-1, 0, 1)
NEIGHBOUR_OFFSETS: Field = set([(x, y) for x in NEAR for y in NEAR if not (x, y) == (0, 0)])
def iterate(field: Field) -> Field:
to_maintain = _maintain_alive_cells(field)
to_spawn = _spawn_new_cells(field)
return to_maintain.union(to_spawn)
NEAR = (-1, 0, 1)
NEIGHBOUR_OFFSETS = [(x, y) for x in NEAR for y in NEAR if not (x, y) == (0, 0)]
def get_neighbours(cell):
x, y = cell
neighbours = {(x + dx, y + dy) for dx, dy in NEIGHBOUR_OFFSETS}
return neighbours
# requires python 3.10, otherwise use `from __future__ import annotations`
import pytest
ALPHABET = ["I", "V", "X", "L", "C", "D", "M"]
ALPHABET_START_OFFSET = 2
SYMBOLS_PER_POSITION = 3
def arabic_to_roman(arabic: int | str) -> str:
app_1 | 192.168.208.2 - 25/Jul/2020:19:12:53 +0000 "GET /status.php" 200
web_1 | 192.168.96.3 - - [25/Jul/2020:19:12:53 +0000] "GET /status.php HTTP/1.1" 200 151 "-" "Mozilla/5.0 (Windows) mirall/2.6.5stable-Win64 (build 20200710) (Nextcloud)" "172.20.0.1"
app_1 | 192.168.208.2 - 25/Jul/2020:19:12:53 +0000 "GET /remote.php" 401
web_1 | 192.168.96.3 - - [25/Jul/2020:19:12:53 +0000] "GET /remote.php/webdav/ HTTP/1.1" 401 426 "-" "Mozilla/5.0 (Windows) mirall/2.6.5stable-Win64 (build 20200710) (Nextcloud)" "172.20.0.1"
app_1 | 192.168.208.2 - 25/Jul/2020:19:12:53 +0000 "PROPFIND /remote.php" 401
web_1 | 192.168.96.3 - - [25/Jul/2020:19:12:53 +0000] "PROPFIND /remote.php/webdav/ HTTP/1.1" 401 426 "-" "Mozilla/5.0 (Windows) mirall/2.6.5stable-Win64 (build 20200710) (Nextcloud)" "172.20.0.1"
app_1 | 192.168.208.2 - 25/Jul/2020:19:12:53 +0000 "GET /ocs/v2.php" 200
web_1 | 192.168.96.3 - - [25/Jul/2020:19:12:53 +0000] "GET /ocs/v2.php/cloud/capabilities?format=json HTTP/1.1" 200 380 "-" "M
git bisect start
# bad: [118fc3ef07c53a88ea1d4c21142a2b01c4648434] Minor performance fix for NEON RAID-Z
git bisect bad 118fc3ef07c53a88ea1d4c21142a2b01c4648434
# good: [e34c3ee2fcbb320525a110c1811c557bc60479ff] Tag 0.8.0
git bisect good e34c3ee2fcbb320525a110c1811c557bc60479ff
# bad: [c9539600484d8f89d48629eb5775c8b1967fe7d7] Fix typos in tests/
git bisect bad c9539600484d8f89d48629eb5775c8b1967fe7d7
# bad: [1086f54219ebcdebf05b8f6bd10142c43c1f4f3f] Revert "Fail early on bio corruption confirmed on 5.2-rc1"
git bisect bad 1086f54219ebcdebf05b8f6bd10142c43c1f4f3f
# good: [5662fd57941d020e23160b271dc27f254fb5a3c6] single-chunk scatter ABDs can be treated as linear
#!/usr/bin/zsh
set -x
PATH=$PWD/bin:$PATH
insmod module/spl/spl.ko
insmod module/lua/zlua.ko
insmod module/nvpair/znvpair.ko
insmod module/unicode/zunicode.ko