869 private links
Reversing Conway's game of life is famously hard to compute. However, it's possible to approximate the inverse using gradient descent if we formulate GoL as a continuous computation.
Here's how it works. We represent the board as a grid of continuous values in [0,1]. To compute the next step, we first take a convolution with a 3x3 kernel equivalent to the summation of the neighboring living cells. Then we map the result into [0, 1] range using a continuous function corresponding to the alive rule. In this article it uses a narrow Gaussian centered at n=3. Then we can compute the gradient descent to figure out an approximation of inverse step.
Creating a git commit from scratch. Covers blob, tree, and commit.
Using linear optimization to calculate movement of pong paddles based on the rhythm of music so that each beat lies on a ball hit. Brilliant idea. https://www.cvxpy.org/ is a python library for modeling convex optimization problem.
Search upscaler models for various purposes.
Rotors are a rotation representation generalized from Quaternions and Complex numbers that works in any numbers of dimensions.
The article starts by pointing out that rotation is defined as a scalar property on a plane. The canonical representation of a plane is a bivector representing the outer product of two vectors. The bivector is in principle a fundamental concept just like the vector. Similar to how a vector represents a point with a scalar length, a bivector represents a plane with a scalar area (signed). The area of a bivector a∧b is |a||b|sin(angle). The reason we also see the term |a||b|sin(angle) from cross product is because cross product actually gives rise to a bivector instead a vector! Historically we've been confusing bivectors with vectors because they have the same representation in 3D.
The inner and outer product completes a geometric product of two vectors: ab=a⋅b+a∧b. Reflection R(a,v) is defined elegantly using geometric product: R(a,v)=-ava. Then it's noted that two reflections is equivalent to a rotation by twice the angle between a and b: R(a,R(b,v))=ba v ab. The "ab" here is known as a rotor. Applying a rotor on both sides of a vector rotates this vector in the plane a∧b by twice the angle between a and b. Quaternion is just a representation of Rotors in 3d: i:=y∧z, j:=z∧x, k:=k∧y. The scalar part (w in w+xi+yj+zk) corresponds to the inner product.
Keywords: bivector, geometric product, rotor, quaternion, rotation
The naive collision detection algorithm takes O(n^2) by checking pairwise intersection. To improve the performance, sort the objects by x coordinates, scan from left to right and only check intersection if a.right < b.left. This method can be extended into 2D to further eliminate the necessary comparisons. Finally, note that insertion sort is more performant on mostly sorted lists than quick sorts, so it's more suitable in this case.
A comprehensive guide on various types of linux virtual networking interfaces. keywords: vlan, vxlan, macvlan, ipvlan, macvtap, ipvtap, veth, vcan, vxcan, ipoib, nlmon, dummy interface, ifb.
In short:
- outline recursively
- speedrun
- DO NOT PERFECT ANYTHING UNTIL DONE
pairs = [ (x,y) | x <- [0..], y <- [0..] ]
This program doesn't really enumerate all "valid" pairs in finite time. For example (0, 1) is never reached because the list will not halt traversing the first component. How can we enumerate the space of all indexable pairs of integers? Moreover, given a recursive context-free grammar, how to write a program that enumerates all valid expressions?
This type of enumeration problems is where the Omega Monad can be useful. It acts like a "breadth-first" search for list comprehension. I recall finding the conde
primitive (sometimes known as condi
) from miniKanren fascinating. Now I learned the Omega Monad is exactly the same thing.
A comprehensive listing of internet search engines out there.
Each element can be styled with multiple box shadows. By programmatically controlling the positions and sizes of each individual box shadow, it's possible to make up a something like a pixel display.
Given a linked list which happens to sit on consecutive memory, traversing it can take advantage of L1 cache. However it's possible to squeeze more performance by hinting the branch predictor to allow speculative execution, resulting in better parallelism with cpu pipeline. This is a simple and interesting trick although I can't think of much practical uses except for specific scenarios.
TIL in sh, you can press C-w
to delete previous word and C-u
to delete the whole line.
An interactive introduction to four-color problem and zero-knowledge proof.
A refreshing viewpoint: when we use UDP as an unreliable protocol, we often actually wants its "timeliness" property, which is to say if we have to choose from dropping two versions of a data, we want to drop the old one. This is why real-time video streaming and gaming choose UDP. The datagram extension in QUIC offers a nice solution. Data are split into streams, within each stream data is ordered. Each stream has a priority attached that is used to determine which packet to drop.
However, how do you choose which to drop without having a bloating buffer that hurts latency? The author suggests using delay-based congestion control like BBR that uses network metrics to probe the bandwidth and RTT.
Analyze various information about the website from an URL. IP, WHOIS, TLS, Cookie, etc. Similar to VirusTotal scan.
The design of HTTP/3 by Daniel Stenberg.
The design of HTTP/2 by Daniel Stenberg.
I stole this technique from Lawrence Block's outstanding Telling Lies for Fun and Profit, a book about writing fiction. He suggests drafting a story the "natural" way, with the first chapter introducing the hero and the second getting the action going, then swapping the two chapters.
Brilliant!
Farside collects a category of alternative libre front-end proxies to popular services. It tests their availability automatically and only show the working ones.