Notes on neural networks from scratch in Clojure

Notes from a shallow look in the deep learning rabbit hole. I stubbornly started in pure Clojure with no libraries, but eventually bent the 'from scratch' rule and 400xd the training speed thanks to a proper matrix math library. The topic is more approachable than I expected — if I had known, I would have dipped my toes in the water earlier.

Heuristic formula for three-outcome Kelly criterion considering p(win, loss, ruin)

The Kelly formula is simple for two outcome version, but it's trickier for three or more outcomes.

Why fractional Kelly? Simulations of bet size with uncertainty and downside risk mitigation

"The Kelly strategy marks the boundary between aggressive and insane investing." True enough. Why though?

A Chrome extension for rendering HTML/JavaScript/CSS in ChatGPT conversations

I built this to get a REPL-like experience with ChatGPT conversations. It transforms code blocks in the output into iframes. Its days are numbered with OpenAI's plugins around the corner, but it has been useful to me in the meantime.

Sizing bets on FTX claims + a Monte Carlo simulation

FTX claims might be undervalued, but it still makes sense to sell down concentrated positions. Plus an interactive Monte Carlo simulation to calibrate bet sizing for these kinds of things.

Notes on using the AWS CDK with Clojure for CloudFormation deployments

This was the first year I was really forced to dig into cloud infra beyond AWS EC2/S3. The CDK is one way of orchestrating repeatable, infrastructure-as-code deployments, and it has Java bindings that I used from Clojure.

Modular multiplicative inverse (Clojure) in ECDSA

Note on elliptic curve digital signature schemes and calculating s = k^-1 * x mod n.

Forcing a JVM heap dump programmatically from Clojure

You can do this live, from the REPL, which is nice sometimes.

Three kinds of Clojure macros

Often you are just wrapping a function body with some logic to execute before and after, but postwalk from the stdlib is also pretty cool.

Effects of crypto derivative market structure on liquidity in March 2020

Some charts, plus speculation that futures backwardation might have reduced latent liquidity.

Exchanges: how do you feel about an average execution price limit order?

Marketable limit orders, perhaps counterintuitively, are useless in thin books.

Using Clojure's swap-vals! in lock-free algorithms

Frustrating to think about all the time I spent on locks, latches, semaphores, and STM when CAS + immutability were there all along.

Clojure-Java interop pattern for avoiding setters

A macro for rewriting some ugly code — Java getters and setters encourage evil data parochialism, anyway.

A* in Clojure to lazily find the shortest paths

Weirdly I couldn't find this in standard graph traversal libraries. How else was I going to find out how much fees eat into N-step arbitrages? My advice: stick to a max of three legs unless you execute passively on each.

Plot multiple Y axis with Incanter & Clojure

This requires some wierd manipulation of the underlying Java charts.

Cryptographic KYC

KYC/AML processes would be greatly improved by the application of Bloom filters, breaking data monopolies and ameliorating privacy risks posed by centralized databases of personally identifiable information. It would make things cheaper for non-banks, too.

Note on signing Ethereum transactions on Ledger Nano S with ethereumjs-tx

Because of EIP155 I found myself needing to tweak the signature data a bit.

Modify a form in the Django admin panel based on the request

One miscellaneous detail among many relevant to customizing the Django admin site.

Extract XPUB from Ledger Nano S (Bitcoin/Ethereum/any HD crypto)

The XPUB is at the root of a nifty tree of keys, and Ledger still doesn't let you access it easily.

Compressing a Bitcoin (elliptic curve) public key

The public key is an (x, y) coordinate pair, but magically you only really need the x coordinate + one byte to indicate the sign of the y coordinate.

Generating a P2WPKH-P2SH (SegWit) Bitcoin address (Python)

Elaboration + code for BIP216's description of backwards-compatible SegWit address generation via nesting within a pay to script hash transaction.