Instantly share code, notes, and snippets.

🎯
Focusing

# AlphaHot

🎯
Focusing
• // TODO
Created January 1, 2024 05:12 — forked from SRechenberger/FreeCHR.py
Example Instances of FreeCHR
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 from itertools import permutations def match(pattern, constraints): return (perm for perm in permutations(constraints, len(pattern)) if all(p(c) for p, c in zip(pattern, perm)) )
Created February 27, 2023 08:37
Boolean Algebra in a nutshell for JS/TS programmers

# Boolean Algebra in a nutshell for JS/TS programmers

There are a lot of strategies that you will hear about in the Javascript community for keeping your conditionals from becoming a tangled mess. This isn't like them. This is someting different. MATH! Boolean Algebra to be exact. I use it all the time to simplify complex conditionals. There are two things that you need to know: de Morgan's Theorem, and Karnaugh (pronounced CAR-no) Maps. (Don't worry, there is no test)

## de Morgan's Theorem

De Morgan's Theorem is great distributing nots (`!`), and for when you want to convert an `&&` to an `||`, or back. This is it:

`````` !(A &amp;&amp; B) = !A || !B
``````
Created August 23, 2022 15:34 — forked from james-d-mitchell/todd_coxeter.py
An implementation of the Todd-Coxeter Algorithm for Semigroups and Monoids in python3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 #!/usr/bin/env python3 class ToddCoxeter: def __init__(self): self.nodes = [0] self.edges = None self.kappa = [] self.next_node = 1 self.R = []
Created November 18, 2021 07:39 — forked from darcyparker/vimModeStateDiagram.svg
Vim Modes Transition Diagram in SVG https://rawgithub.com/darcyparker/1886716/raw/eab57dfe784f016085251771d65a75a471ca22d4/vimModeStateDiagram.svg Note, most of the nodes in this graph have clickable hyperlinks to documentation.
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Created May 15, 2020 09:56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 def cntBit(num): return len(bin(num)) - 2 print(cntBit(0xFFFFFFFF)) # 32
Created April 25, 2020 08:15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
 free_entry **fe; for ( fe = &first_free_entry; (*fe)->next && ( reinterpret_cast ((*fe)->next) > reinterpret_cast (e) + sz ); fe = &(*fe)->next
Created February 8, 2020 13:03 — forked from darconeous/tesla-key-card-protocol.md
Tesla Key Card Protocol

# Tesla Key Card Protocol

Researched by Robert Quattlebaum darco@deepdarc.com.

Last updated 2020-02-03.