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.

— Permalink]]>

Creating a git commit from scratch. Covers blob, tree, and commit.

— Permalink]]>

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.

— Permalink]]>

Search upscaler models for various purposes.

— Permalink]]>

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

— Permalink]]>

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.

— Permalink]]>

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.

— Permalink]]>

In short:

- outline recursively
- speedrun
- DO NOT PERFECT ANYTHING UNTIL DONE

— Permalink]]>

`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.

— Permalink]]>

A comprehensive listing of internet search engines out there.

— Permalink]]>

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.

— Permalink]]>

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.

— Permalink]]>

TIL in sh, you can press `C-w`

to delete previous word and `C-u`

to delete the whole line.

— Permalink]]>

An interactive introduction to four-color problem and zero-knowledge proof.

— Permalink]]>

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.

— Permalink]]>

Analyze various information about the website from an URL. IP, WHOIS, TLS, Cookie, etc. Similar to VirusTotal scan.

— Permalink]]>

The design of HTTP/3 by Daniel Stenberg.

— Permalink]]>

The design of HTTP/2 by Daniel Stenberg.

— Permalink]]>

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!

— Permalink]]>

Farside collects a category of alternative libre front-end proxies to popular services. It tests their availability automatically and only show the working ones.

— Permalink]]>

Vulkan learning guide.

— Permalink]]>

Detailed scan report for URL: domain/IP info, http transactions, links, javascript behavior analysis, etc.

— Permalink]]>

VirusTotal has this public tool that shows detailed information about IP address/domain: historical Whois lookup and certificate log. Similar to crt.sh.

— Permalink]]>

I always confuse the concept of ours and theirs. Every time I have to choose one I need to search which is which. Turns out I'm not alone! This website explains what each term refers to. TL;DR: the currently checked out branch is "ours" in merge, but "theirs" in rebase.

— Permalink]]>

TIL the faintness sensation come from hyperventilation is a result of respiratory alkalosis, which is caused by reduced CO2 (acidic) level in blood. CO2 is equilibrated with HCO3- (basic) in blood as a pH buffering solution. The lung controls the amount of CO2 whereas the kidney controls the amount of HCO3-. So breathing rate is determined by the level of CO2. Although the CO2 exhaled contributes to the majority of weight loss in human, hyperventilation is not a feasible way to lose weight because the benefit is marginal compared to the downside of respiratory alkalosis. A better way to lose weight is through producing more CO2, which is achieved by increasing metabolism rate.

— Permalink]]>

Pratt parsing is a parsing algorithm that solves the awkward handling of left-recursion in a recursive descent parser. It elegantly handles both operator precedence and associativity using a single "binding power" concept. The core algorithm is as simple as follows:

```
fn expr(input: &str) -> S {
let mut lexer = Lexer::new(input);
expr_bp(&mut lexer, 0)
}
fn expr_bp(lexer: &mut Lexer, min_bp: u8) -> S {
let mut lhs = match lexer.next() {
Token::Atom(it) => S::Atom(it),
t => panic!("bad token: {:?}", t),
};
loop {
let op = match lexer.peek() {
Token::Eof => break,
Token::Op(op) => op,
t => panic!("bad token: {:?}", t),
};
let (l_bp, r_bp) = infix_binding_power(op);
if l_bp < min_bp {
break;
}
lexer.next();
let rhs = expr_bp(lexer, r_bp);
lhs = S::Cons(op, vec![lhs, rhs]);
}
lhs
}
fn infix_binding_power(op: char) -> (u8, u8) {
match op {
'+' | '-' => (1, 2),
'*' | '/' => (3, 4),
_ => panic!("bad op: {:?}"),
}
}
```

— Permalink]]>

Like the now shut down RawGit, it's a free CDN for serving raw files from GitHub and other platforms.

— Permalink]]>

```
curl ifconfig.io
curl ifconfig.me
curl ifconfig.co
curl ip.sb
curl icanhazip.com
curl myip.wtf/text
curl geofind.me # has geolocation info
```

port reachability test:

`ifconfig.co/port/22`

— Permalink]]>

Method: train a sparse autoencoder on the activation on the residual stream. The sparsely activated components ensure only few features are activated for similar activation patterns in residual stream. Each of the feature is in turn interpreted by an LLM for its semantics. One can use these feature to semantically interpret the working of the model and steer the model towards desired goals.

— Permalink]]>

A database of captured fMRI videos for the articulation of various sounds in the IPA.

— Permalink]]>

An IPA chart with example pronunciations.

— Permalink]]>

An interger hash function is a bijection in the domain of N-bit unsigned integers with hashing properties. To make a good hash function, for each flip in input bit, roughly 1/2 of the output bit should flip (known as "high avalanche effect"). Furthermore, there should be no correlation between flipped input bits and output bits (known as "low bias"). The author of this article describes an algorithm to generate integer hash functions by composing reversible functions, and test the two hashing properties on the function to find the best ones.

— Permalink]]>

A LLM uncensoring technique by finding the embedding direction of refusals in the residual stream outputs. One can choose to negate the refusal direction in the output to block the representation of refusals.

More on LLM steering by adding activation vectors: https://www.lesswrong.com/posts/5spBue2z2tw4JuDCx/steering-gpt-2-xl-by-adding-an-activation-vector

— Permalink]]>

A non-traditional neuron network architecture where the activation functions are trained instead of fixed as in multi-layer perceptron (MLP). The output of the activation functions are merely summed in each layer. Each of the activation function is described as a linear combination of basis functions where the coefficients are trained.

Read https://github.com/GistNoesis/FourierKAN/ for a simple implementation of the core idea. See further discussion at https://news.ycombinator.com/item?id=40219205.

— Permalink]]>

This approach originates from the question: how much does the architecture compared to the weights that affect the performance of a neuron network?

This article describes a non-traditional machine learning approach: using genetic algorithm to find NN architectures optimized for 1) weight-agnostic and 2) least complex. The resulting architecture works for a wide range of weight shared across the nodes.

— Permalink]]>

An IDE and debugger for the esoteric programming language Piet.

— Permalink]]>

In-depth and low-level knowledge about GPU.

— Permalink]]>

Normally when we implement ray tracing, each ray of light carries a RGB vector. Spectral Ray Tracing is the technique of instead of treating a ray of light as a particle in a straight line, the algorithm treats light as a wave spectrum - spectral power distribution (SPD). This allows more realistic rendering such as dispersion, diffraction, etc.

— Permalink]]>

A 4-part writeup on how GPS works and how to implement a GPS receiver: I/Q data, asynchronous CDMA, GPS C/A and P code, Heterodyne demodulation, etc.

— Permalink]]>

Even life as simple as virus has evolved mechanism of cooperation and competition - on a molecular level. Amazing!

— Permalink]]>

Search images from Reddit and Instagram by semantic meaning or a similar image.

— Permalink]]>

A comprehensive list of frequently seen concepts in electronics.

— Permalink]]>

Netfilter TPROXY target explained.

— Permalink]]>

The part most interest me is how to use Linux network namespace to experiment with network layouts on the same machine.

— Permalink]]>

They look really fun!

— Permalink]]>

Tool to draw/generate funnel diagram from textual input. "Came in a fluffer" style.

— Permalink]]>

Valuable SQLite tips for the use on a production servers.

— Permalink]]>

Chemotaxis is a great slice: it’s a triumph of systems biology—we understand it holistically but also in fine detail at almost every level.

— Permalink]]>

A nice explainer of the JTAG protocol. JTAG started as a protocol for testing connectivity between pins of ICs on a circuit board.

— Permalink]]>

TIL signed distance field. First I need to explain the concept of alpha testing. Alpha testing is a rendering technique for textures. It dictates that when rendering a texture, perform a test on the alpha value of that pixel against a threshold. Completely throw out or keep the data depending on the comparison result. Typically the alpha value for each pixel is set to the actual transparency of the pixel. This signed distance field method calculates the signed distance of each pixel to the nearest color pixels. The signed instance field is then saved in alpha channel in the texture. All the remaining alpha-testing mechanism is the same. It's claimed that this technique improves the rendering quality of low-resolution textures drastically.

Read the original paper: https://steamcdn-a.akamaihd.net/apps/valve/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf

— Permalink]]>