safe-> is a safe navigation macro for Clojure. It extends some-> with additional guards:
- doesn’t call nil values
- doesn’t call missing methods (ClojureScript only)
by the time you're reading this, this probably no longer works since the policy has been removed. I reccomend you to check out https://github.com/r58Playz/uBlock-mv3 instead
webRequestBlocking API, which is neccesary for (effective) adblockers to workExtensionManifestV2Availability key was added and will presumably stay forever after enterprises complain enoughYou can use this as a regular user, which will let you keep your mv2 extensions even after they're supposed to stop working
#!/usr/bin/env sed -re s|^|\x20\x20\x20\x20| -e s|^\x20{4}\x23\x23{(.*)$|<details><summary>\1</summary>\n| -e s|^\x20{4}\x23\x23}$|\n</details>| -e s|^\x20{4}\x23\x23\x20?|| -e s|\x0c|\x20|
# Yannakakis.py by Paul Khuong
#
# To the extent possible under law, the person who associated CC0 with
# Yannakakis.py has waived all copyright and related or neighboring rights
# to Yannakakis.py.
| const std = @import("std"); | |
| const assert = std.debug.assert; | |
| /// An intrusive heap implementation backed by a pairing heap[1] implementation. | |
| /// | |
| /// Why? Intrusive data structures require the element type to hold the metadata | |
| /// required for the structure, rather than an additional container structure. | |
| /// There are numerous pros/cons that are documented well by Boost[2]. For Zig, | |
| /// I think the primary benefits are making data structures allocation free | |
| /// (rather, shifting allocation up to the consumer which can choose how they |
| # I happened to be looking at some of Cranelift's code, and I noticed that their constant-time dominates() | |
| # check was using a somewhat more ad-hoc version of a hidden gem from the data structures literature called the | |
| # parenthesis representation for trees. As far as I know, this was invented by Jacobson in his 1989 paper | |
| # Space-Efficient Static Trees and Graphs. I first learned about it from the slightly later paper by Munro and Raman | |
| # called Succinct Representations of Balanced Parentheses and Static Trees. I figured I'd give it an extremely | |
| # quick intro and then show how it leads to a (slightly better) version of Cranelift's algorithm. | |
| # | |
| # This parenthesis representation of trees is surprisingly versatile, but its most striking feature is that | |
| # it lets us query the ancestor relationship between two nodes in a tree in constant time, with a few instructions. | |
| # And the idea is extremely simple and intuitive if you just draw the right kind of picture. |
| ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
| ;; | |
| ;; Solo freelancer's S-Corp tax optimization | |
| ;; | |
| ;; Assumes an unmarried single-shareholder and tons of other stuff. | |
| ;; I'm not a tax professional, no guarantees here, probably typos, etc. Come on! | |
| ;; Run with https://github.com/Z3Prover/z3 | |
| ;; | |
| ;; See also my notes at https://kevinlynagh.com/financial-plan/ |
| // SFC32 random number generator, public domain code adapted | |
| // from https://github.com/bryc/code/blob/master/jshash/PRNGs.md | |
| function PRNG(seed: number): { | |
| nextInt(): number; | |
| nextFloat(): number; | |
| getState(): number[]; | |
| setState(state: number[]): void | |
| } { | |
| let a = 0, b = seed, c = 0, d = 1; | |
| function sfc32() { |
| //! Implements a texture atlas (https://en.wikipedia.org/wiki/Texture_atlas). | |
| //! | |
| //! The implementation is based on "A Thousand Ways to Pack the Bin - A | |
| //! Practical Approach to Two-Dimensional Rectangle Bin Packing" by Jukka | |
| //! Jylänki. This specific implementation is based heavily on | |
| //! Nicolas P. Rougier's freetype-gl project as well as Jukka's C++ | |
| //! implementation: https://github.com/juj/RectangleBinPack | |
| //! | |
| //! Limitations that are easy to fix, but I didn't need them: | |
| //! |
A traditional table-based DFA implementation looks like this:
uint8_t table[NUM_STATES][256]
uint8_t run(const uint8_t *start, const uint8_t *end, uint8_t state) {
for (const uint8_t *s = start; s != end; s++)
state = table[state][*s];
return state;
}