Skip to content

Instantly share code, notes, and snippets.

@vyznev
vyznev / se_no_sticky_topbar.user.js
Last active Apr 4, 2022
Disable the sticky top bar on Stack Exchange sites
View se_no_sticky_topbar.user.js
// ==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/*
@vyznev
vyznev / etcsl_charenc_fix.user.js
Last active Mar 31, 2021
The ETCSL website sometimes loses track of the selected encoding. This script fixes it and makes switching between Unicode and ASCII easy.
View etcsl_charenc_fix.user.js
// ==UserScript==
// @name ETCSL charenc fix
// @namespace https://github.com/vyznev/
// @description The ETCSL website sometimes loses track of the selected encoding. This script fixes it and makes switching between Unicode and ASCII easy.
// @author Ilmari Karonen
// @version 1.1
// @match *://etcsl.orinst.ox.ac.uk/*
// @homepageURL https://gist.github.com/vyznev/b078af6b3574f80879f93675f59d8c86
// @downloadURL https://gist.github.com/vyznev/b078af6b3574f80879f93675f59d8c86/raw/etcsl_charenc_fix.user.js
// @run-at document-start
@vyznev
vyznev / throttle_steering.ks
Created Sep 2, 2020
kOS script for differential throttle augmented steering
View throttle_steering.ks
// This script sets up a background trigger that automatically adjusts engine throttle according to the yaw / pitch / roll
// commands of the kOS built-in steering manager. This can allow a vessel to be controlled even without any reaction wheels,
// gimbals or control surfaces, and can also provide additional control authority and stability on top of normal steering
// especially for vessels with asymmetric thrust.
//
// The operation of the trigger is controlled by a number of global variables:
//
// * Setting dt_flag to false will terminate the trigger loop.
// * The loop will adjust throttle on any engines listed in dt_engines (by default, all engines on the vessel).
// * The baseline thrust limit on all controlled engines, in the absence of steering input, is set to dt_base percent.
@vyznev
vyznev / dice_roll.py
Last active Sep 16, 2021
A simple bare-bones dice probability calculator framework, compatible with both Python 2 and Python 3
View dice_roll.py
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
@vyznev
vyznev / apgdecode.py
Last active Feb 4, 2019
Golly script for loading apgcodes as patterns
View apgdecode.py
#! /usr/bin/python
# apgdecode.py v0.2
# A script for loading apgcodes (http://conwaylife.com/wiki/Apgcode) as Golly (http://golly.sourceforge.net/) patterns.
# Supports extended and multistate apgcodes. (Multistate handling may still have bugs. Let me know if you find any.)
# Copyright 2019 Ilmari Karonen. Released under the WTFPL (http://www.wtfpl.net/).
import golly as g
import re
@vyznev
vyznev / se-sticky-vote-buttons.user.js
Last active Aug 26, 2021
Enable sticky vote buttons on Stack Exchange sites
View se-sticky-vote-buttons.user.js
// ==UserScript==
// @name SE Sticky Vote Buttons
// @namespace https://github.com/vyznev/
// @description Enable sticky vote buttons on Stack Exchange sites
// @author Ilmari Karonen
// @version 0.6.0
// @copyright 2018-2021, Ilmari Karonen
// @downloadURL https://gist.github.com/vyznev/607e86f3890d920f67d7cbd6c5f78e7b/raw/se-sticky-vote-buttons.user.js
// @match *://*.stackexchange.com/*
// @match *://*.stackoverflow.com/*
@vyznev
vyznev / se-bounty-bar.user.js
Last active Apr 11, 2021
Stack Exchange Bounty Bar user script (prototype)
View se-bounty-bar.user.js
// ==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/*
@vyznev
vyznev / neumann2moore_partial.py
Created Feb 3, 2018
Convert pairs of isotropic CA rule strings on the 4-cell von Neumann neighborhood into a Logic Life Search partial rule dictionary.
View neumann2moore_partial.py
#!/usr/bin/python
import re
import sys
import argparse
parser = argparse.ArgumentParser(description='Generate LLS rule dict to search multiple isotropic CA rules on the 4-cell von Neumann neighborhood.')
parser.add_argument('minrule', help='minimum rule string (e.g. B0/S)')
parser.add_argument('maxrule', nargs='?', help='maximum rule string (e.g. B0234/S01)')
parser.add_argument('-t', '--totalistic', action='store_true', help='consider only (outer) totalistic rules, i.e. treat 2e and 2i as equivalent')
@vyznev
vyznev / neumann2moore.py
Last active Feb 3, 2018
Convert isotropic CA rule strings from the 4-cell von Neumann neighborhood to the 8-cell Moore neighborhood
View neumann2moore.py
#!/usr/bin/python
neumann2moore = {
"0": {0: "", 1: "c", 2: "cn", 3: "c", 4: "c"},
"1": {1: "e", 2: "ka", 3: "inyq", 4: "ny", 5: "e"},
"2e": {2: "e", 3: "kaj", 4: "kaqw", 5: "kaj", 6: "e"},
"2i": {2: "i", 3: "r", 4: "itz", 5: "r", 6: "i"},
"3": {3: "e", 4: "jr", 5: "inyq", 6: "ka", 7: "e"},
"4": {4: "e", 5: "c", 6: "cn", 7: "c", 8: ""}
}
@vyznev
vyznev / make_lls_grid.py
Last active Aug 9, 2019
Generate Logic Life Search (LLS) input grid for finding spaceships and oscillators, with additional features not yet supported natively by LSS (like strobing background and gradually moving search area).
View make_lls_grid.py
#!/usr/bin/python
import re
import sys
import argparse
def fail(msg):
sys.stderr.write(sys.argv[0] + ": " + msg + "\n")
sys.exit(1)