Skip to content

Instantly share code, notes, and snippets.

View 1f604's full-sized avatar

Professional Computer Toucher ( F Y ) 1f604

View GitHub Profile
@1f604
1f604 / unifieddiff.py
Created February 11, 2022 18:58 — forked from noporpoise/unifieddiff.py
Apply unified diff patches in pure python2/3
#!/usr/bin/env python
# coding=utf-8
# License: Public domain (CC0)
# Isaac Turner 2016/12/05
from __future__ import print_function
import difflib
import re
@1f604
1f604 / matrix_shuffle.py
Created December 20, 2018 17:46 — forked from anonymous/matrix_shuffle.py
matrix_shuffle.py
"""
Computes the probability distribution of states created by
the shuffle2 algorithm. This should return results similar to
enumerate_shuffle.py.
A state is a 2-tuple: (swapped, deck)
The probability of transitioning from one state to another can be represented by
a Markov matrix M.