Skip to content

Instantly share code, notes, and snippets.

View patio11's full-sized avatar

Patrick McKenzie patio11

View GitHub Profile
@patio11
patio11 / bitfinex-03152019.md
Created April 26, 2019 00:29
`shasum bitfinex-03152019.md` is 938d939059a23aa84ce493db0c4d542748f849a7

Prediction as of 3/15/2019 JST:

  • Bitfinex is insolvent, for the Bitcoin economy's usual quixotic definition of insolvent.
  • This happened as a result of collateralizing Tether with BTC and other cryptocurrencies during the run-up.
  • Bitfinex / Tether treat whether Bitfinex held the collateral or Tether held the collateral as a material distinction, but that's ridiculous due to common control. The important fact: in 2018, ground truth diverged from "There is $1 in a bank account for every tether outstanding" to "There is $1 in a bank account and/or $1 worth of Bitcoin at prevailing prices available to Bitfinex for every tether outstanding."
  • This makes Tether synthetically long Bitcoin, via a receivable from Bitfinex. Bitfinex took the newly issued Tether and then, since this accounting shellgame appears to balance its books and leave it with surplus Bitcoin, either sold or lent the Bitcoin to short sellers during the run-up.
  • If Bitfinex simply sold the Bitcoin, they're doing relatively well for themselve
@patio11
patio11 / monte-carlo-that-perl.rb
Created October 28, 2019 07:55
monte carlo simulation for perl random line generator
NUMBER_OF_BUCKETS = 100
EXPECTED_BUCKET_SIZE = 100
file = "1-to-#{NUMBER_OF_BUCKETS}.txt"
f = File.open(file, "w")
contents = (1..NUMBER_OF_BUCKETS).to_a.map(&:to_s).join("\n")
f.write(contents)
f.close()
command = "cat #{file} | perl -e 'while(<>){$x=$_ if rand()<=(1/$.)}print $x'"
@patio11
patio11 / nixie-console-copypasta.lua
Created February 13, 2024 15:43
Monkeypatching Factorio mods for compatibility
-- Thanks to ChatGPT for improving my lua ability
local player = game.player
local surface = player.surface
local sprite_names = {'SNTD-nixie-tube-small-sprite', 'SNTD-nixie-tube-sprite'}
local all_nixie_sprites = surface.find_entities_filtered{name=sprite_names}
local known_sprites = {}