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
import hashlib | |
from functools import reduce | |
inputs = """\ | |
4987a884 | |
dc917386 | |
54c4938a | |
dcf3388d | |
22e1e08f | |
02e29593 |
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 sage | |
import itertools | |
# cycle decomposition of a permutation | |
def cycles(perm): | |
seen = [False] * len(perm) | |
for i in range(len(perm)): | |
if seen[i]: | |
continue | |
cycle = [i] |
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
// This is a technique to emulate lifetime GATs (generic associated types) on stable rust starting | |
// with rustc 1.33. | |
// | |
// I haven't seen this exact technique before, but I would be surprised if no one else came up with | |
// it. I think this avoids most downsides of other lifetime GAT workarounds I've seen. | |
// | |
// In particular, neither implementing nor using traits with emulated lifetime GATs requires adding | |
// any helper items. Only defining the trait requires a single helper trait (+ a single helper impl | |
// for the 2nd variant) per GAT. This also makes the technique viable without any boilerplate | |
// reducing macros. |
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 sympy.logic import SOPform | |
from sympy import symbols | |
from functools import partial, reduce | |
from itertools import product, combinations | |
import networkx as nx | |
import z3 | |
HEADER = """module serv_auto_decode | |
( | |
input wire i_clk, |
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
// ==UserScript== | |
// @name docs.rs hotkey for crates.io | |
// @namespace Violentmonkey Scripts | |
// @match https://crates.io/* | |
// @grant none | |
// @version 1.1 | |
// @author @jix_ | |
// @description Press d to open the docs.rs link for the currently viewed crate on crates.io. | |
// ==/UserScript== |
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
# Copyright 2021 Jannis Harder | |
# Permission to use, copy, modify, and/or distribute this software for any | |
# purpose with or without fee is hereby granted. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
# SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
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
// ==UserScript== | |
// @name Resolve t.co links on twitter | |
// @namespace Violentmonkey Scripts | |
// @match *://twitter.com/* | |
// @grant GM_xmlhttpRequest | |
// @version 1.1 | |
// @author @jix_ | |
// @homepage https://gist.github.com/jix/e67c127820954e1d1571c1f6f800ac2c | |
// @description Tries to resolve all annoying t.co links on twitter and replaces them with the | |
// target URL. |
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 | |
from livereload import Server, shell | |
import shlex | |
import sys | |
import os | |
import toml | |
config = toml.load('Cargo.toml') | |
cmd = 'cargo +nightly doc ' + shlex.join(sys.argv[1:]) | |
server = Server() |
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
# Copyright 2020 Jannis Harder | |
# | |
# Permission to use, copy, modify, and/or distribute this software for any | |
# purpose with or without fee is hereby granted. | |
# | |
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | |
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY | |
# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | |
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | |
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR |
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
# Return a representative of each conjugacy class of maximal subgroups of a | |
# permutation group that stabilize a block or point. These are the maximal | |
# subgroups whose orbit parition is a strict refinement of the whole groups | |
# orbit partition. | |
# | |
# The result is a list of pairs containing the representative subgroup and the | |
# block or point for which it is the stabilizer. A point is returned as a block | |
# of size 1. | |
MaximalBlockStabilizerClassReps := function ( G ) | |
local i, pt, pt2, orb, lorb, on_lorb, l2g, block_reps, block_rep, |
NewerOlder