Skip to content

Instantly share code, notes, and snippets.

@mozz100
mozz100 / fa-cup.js
Last active January 31, 2023 21:06
Visualise some FA cup fixtures... which one is the best one to go to?
'use strict';
var config = {
type: Phaser.WEBGL,
parent: 'phaser-example',
width: 500,
height: 500,
scene: {
preload: preload,
create: create
@mozz100
mozz100 / fa-cup.py
Last active January 24, 2023 22:18
Compute coefficients for FA Cup probability trees. See https://www.rmorrison.net/mnemozzyne/2023/01/24/optimising-the-fa-cup/
"""
Compute coefficients for FA Cup probability trees.
See https://www.rmorrison.net/mnemozzyne/2023/01/24/optimising-the-fa-cup/
"""
from typing import List
from dataclasses import dataclass
@dataclass
@mozz100
mozz100 / big-primes.ipynb
Created September 25, 2017 21:37
Prime numbers
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mozz100
mozz100 / semantic-pedantic.md
Last active January 8, 2016 14:19 — forked from jashkenas/semantic-pedantic.md
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

Note: just a feeling. Feelings are human and can be erroneous

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

"Us" meaning who... users? I think version numbers

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mozz100
mozz100 / keybase.md
Created February 27, 2015 12:54
keybase.md

Keybase proof

I hereby claim:

  • I am mozz100 on github.
  • I am mozz (https://keybase.io/mozz) on keybase.
  • I have a public key whose fingerprint is 1BDB 23C4 5299 08F6 B042 83F5 4414 F64B 6368 2CDA

To claim this, I am signing this object:

@mozz100
mozz100 / simple_web_server.py
Created February 2, 2015 11:00
Very simple web server
# A VERY simple (naive?) web server.
# Listens for requests (on a socket) and responds with HTML responses.
# There are some obvious problems with this (it's really very basic). For instance,
# it responds to ALL requests with 200 OK and HTML.
# Code based on http://code.activestate.com/recipes/576541-very-simple-http-web-server/
from socket import *
HOST = '' # Can put '127.0.0.1' - meaning the local host
PORT = 5000 # Arbitrary non-privileged port
@mozz100
mozz100 / hosts
Created December 4, 2014 10:59
Ansible list syntax - apparently confusing behaviour
localhost ansible_connection=local
@mozz100
mozz100 / runserver.py
Last active June 13, 2021 02:57
Change default port for django runserver
# Put this at <yourapp>/management/commands/runserver.py.
# Override the value of the constant coded into django...
import django.core.management.commands.runserver as runserver
runserver.DEFAULT_PORT="8197"
# ...and then just import its standard Command class.
# Then manage.py runserver behaves normally in all other regards.
from django.core.management.commands.runserver import Command
@mozz100
mozz100 / logging_webserver.py
Created October 7, 2014 20:37
Tiny python web server that just logs stuff
#!/usr/bin/env python
import tornado.ioloop
import tornado.web
import pprint
class MyDumpHandler(tornado.web.RequestHandler):
def post(self):
pprint.pprint("Request")
pprint.pprint(self.request)