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 dice_roll(die, count = 1, select = None): | |
"""Generate all possible results of rolling `die` `count` times, sorting | |
the results (according to the order of the sides on the die) and selecting | |
the first `select` elements of it. | |
The yielded results are tuples of the form `(roll, prob)`, where `roll` is a | |
sorted tuple of `select` values and `prob` is the probability of the result. | |
The first argument can be either a custom die, i.e. a tuple of `(side, prob)` | |
pairs, where `prob` is the probability of rolling `side` on the die, or just |
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 PIL import Image | |
import numpy as np | |
import itertools | |
flatten = itertools.chain.from_iterable | |
max_depth = 8 | |
img = Image.open('David_Hilbert_postcard_edit2.png') | |
img = img.convert('L').resize((2**max_depth,) * 2) | |
img = img.point(lambda i: (1 - i/255 * 0.75) * 128 ) |
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 Stack Exchange hotness estimator | |
// @namespace http://vyznev.net/ | |
// @description Estimates how highly each Stack Exchange question would rank on the Hot Network Questions list | |
// @author Ilmari Karonen | |
// @version 0.4.3 | |
// @license Public domain | |
// @homepageURL https://meta.stackexchange.com/a/284933 | |
// @downloadURL https://gist.github.com/vyznev/bb2c1adb6e96eb65a87bab3822c74e81/raw/se_hotness_estimator.user.js | |
// @match *://*.stackexchange.com/questions/* |
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 SE No Sticky Top Bar | |
// @namespace https://github.com/vyznev/ | |
// @description Disables the sticky top bar on Stack Exchange sites | |
// @author Ilmari Karonen | |
// @version 0.3.0 | |
// @copyright 2021-2022, Ilmari Karonen | |
// @downloadURL https://gist.github.com/vyznev/7c9a7ddc5c057d4c895864e460b4a88d/raw/se_no_sticky_topbar.user.js | |
// @homepageURL https://meta.stackexchange.com/a/368984 | |
// @match *://*.stackexchange.com/* |
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 Circle OP's username on Meta.SE | |
// @version 1.1 | |
// @description Restyle the OP's username in comments on Meta.SE so that it's circled by a red ellipse. | |
// @namespace https://github.com/vyznev/ | |
// @author Ilmari Karonen | |
// @license ISC (http://opensource.org/licenses/ISC) | |
// @match *://meta.stackexchange.com/* | |
// @grant none | |
// @run-at document-start |
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 Reveal nofollow links on Stack Exchange | |
// @version 1.3 | |
// @namespace http://vyznev.net/ | |
// @description Colors all links with rel=nofollow red on the Stack Exchange network. (Works on other sites too, if you edit the includes.) | |
// @author Ilmari Karonen | |
// @license ISC (http://opensource.org/licenses/ISC) | |
// @match *://*.stackexchange.com/* | |
// @match *://*.stackoverflow.com/* | |
// @match *://*.superuser.com/* |
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 Disable display math in comments | |
// @namespace https://github.com/vyznev/ | |
// @description Forces all MathJax elements in comments to be rendered inline | |
// @author Ilmari Karonen | |
// @version 1.1 | |
// @match *://*.stackexchange.com/* | |
// @match *://*.mathoverflow.net/* | |
// @homepageURL http://meta.math.stackexchange.com/questions/23250/disable-display-math-in-comments | |
// @grant none |
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 Code Golf SE sorter | |
// @namespace http://vyznev.net/ | |
// @version 0.6 | |
// @description Add a tab to sort answers by code length | |
// @match *://codegolf.stackexchange.com/questions/* | |
// @copyright 2014, Ilmari Karonen | |
// @grant none | |
// ==/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
// ==UserScript== | |
// @name Stack Exchange Bounty Bar | |
// @namespace https://github.com/vyznev/ | |
// @description Shows a randomized selection of bountied questions in the Stack Exchange sidebar | |
// @author Ilmari Karonen | |
// @version 0.0.19 | |
// @copyright 2018, Ilmari Karonen | |
// @license ISC; https://opensource.org/licenses/ISC | |
// @match *://*.stackexchange.com/* | |
// @match *://*.stackoverflow.com/* |
NewerOlder