Skip to content

Instantly share code, notes, and snippets.

@ldub
ldub / main.py
Created September 5, 2023 05:34
Python Reference Model
from typing import Dict, List
database = {
"apple": "red",
"banana": "yellow",
"cherry": "red"
}
def fruit_colors() -> List[str]:
fruit_color_cache: Dict[str, str] = {}
diff --git a/pkgs/build-support/trivial-builders/default.nix b/pkgs/build-support/trivial-builders/default.nix
index 871f9722a4a..be329a6881a 100644
--- a/pkgs/build-support/trivial-builders/default.nix
+++ b/pkgs/build-support/trivial-builders/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, stdenvNoCC, lndir, runtimeShell, shellcheck, haskell }:
+{ lib, stdenv, stdenvNoCC, lndir, runtimeShell, shellcheck, haskell, argbash }:
let
inherit (lib)
❯ nix build
error: builder for '/nix/store/3fl3fvrgs1ap0hsj5gjzfg9c77kn92hs-perl-5.36.0.drv' failed with exit code 2;
last 10 log lines:
> opmini.o perlmini.o universalmini.o gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro_core.o keywords.o builtin.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o globals.o perlio.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o caretx.o dquote.o time64.o miniperlmain.o
> DYLD_LIBRARY_PATH=/private/tmp/nix-build-perl-5.36.0.drv-0/perl-5.36.0 ./miniperl -w -Ilib -Idist/Exporter/lib -MExporter -e '<?>' || sh -c 'echo >&2 Failed to build miniperl. Please run make minitest; exit 1'
> DYLD_LIBRARY_PATH=/private/tmp/nix-build-perl-5.36.0.drv-0/perl-5.36.0 ./miniperl -Ilib -f write_buildcustomize.pl
> DYLD_LIBRARY_PATH=/private/tmp/nix-build-perl-5.36.0.drv-0/perl-5.36.0 ./miniperl -Ilib autodoc.pl
> DYLD_LIBRARY_PATH=/private/tmp/nix-build-perl-5.36.0.drv
# If syntax highlighting is working, this comment should be gray, not black.
# Fun fact there are exactly 64 {} before the comment, and 64 is a computer number. Seems related!
[
{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
{} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {}
{} {} {} {} {} {} {} {} {} {} {}
# Comment the line below to fix syntax highlighting:
{}
]

Mar 25, 2020, 9:39 AM

I am an ER MD in New Orleans. Class of 98. Every one of my colleagues have now seen several hundred Covid 19 patients and this is what I think I know.

Clinical course is predictable. 2-11 days after exposure (day 5 on average) flu like symptoms start. Common are fever, headache, dry cough, myalgias (back pain), nausea without vomiting, abdominal discomfort with some diarrhea, loss of smell, anorexia, fatigue.

Day 5 of symptoms- increased SOB, and bilateral viral pneumonia from direct viral damage to lung parenchyma.

Day 10- Cytokine storm leading to acute ARDS and multiorgan failure. You can literally watch it happen in a matter of hours.

@ldub
ldub / Main.hs
Created March 10, 2020 02:46
Xmlbf Example
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedLists #-}
module Main where
import qualified Data.ByteString as BS
import Data.HashMap.Strict (HashMap)
import Data.Text (Text)
import Data.Text.Lazy (toStrict, fromStrict)
import qualified Xmlbf as X
@ldub
ldub / 01_demo_results.md
Created November 30, 2019 02:55
infura blockhash inconsistency demo

Over the course of 10 seconds, Infura has provided us THREE different blockhashes for Goerli block number 1737483:

  • 0x0519d356808abca8849b7c50c6cf2ae8bc63c2e357b42578712c181378621981 (the one currently in the longest chain)
  • 0xf15f439f00a6c7d3138e9a334958d15ed50b2b5eb4d180ffb4a3ec243e1bdc06
  • 0xaa0266d7965dbb5cd4b88a11927a593be550df896374e7deb55508327b25d878

Also important to note that a getLogs and getBlock issues within the same second can return different blockhashes for the same block number.

========================================================================
2019-11-29 18:47:14,477 web3.provider [DEBUG]: Making request HTTP. URI: https://goerli.infura.io/v3/redacted, Method: eth_blockNumber
@ldub
ldub / trie.js
Last active November 21, 2019 21:59
Trie for bip39
// assumes words are all on one line split by spaces
//const words = require("fs").readFileSync("bip39.txt", "utf8").split(" ").sort();
const words = "animal adjective animation build bridge".split(" ").sort()
let trie = {};
for (let i = 0; i < words.length; i++ ) {
const word = words[i];
const letters = word.split("");
let pointer = trie; // save pointer for traversal
@ldub
ldub / gist:f18606c89bbf2a9d104f4af39217c336
Last active November 21, 2019 21:58
AWS Region / AZ / Instance Type tuples
ap-northeast-1;ap-northeast-1a;"a1.2xlarge"
ap-northeast-1;ap-northeast-1a;"a1.4xlarge"
ap-northeast-1;ap-northeast-1a;"a1.large"
ap-northeast-1;ap-northeast-1a;"a1.medium"
ap-northeast-1;ap-northeast-1a;"a1.metal"
ap-northeast-1;ap-northeast-1a;"a1.xlarge"
ap-northeast-1;ap-northeast-1a;"c1.medium"
ap-northeast-1;ap-northeast-1a;"c1.xlarge"
ap-northeast-1;ap-northeast-1a;"c3.2xlarge"
ap-northeast-1;ap-northeast-1a;"c3.4xlarge"
@ldub
ldub / 01_f2pool_shielded_transactions.txt
Last active November 21, 2019 21:55
f2pool-shielded-transactions
See https://medium.com/@levdubinets/zcash-shielded-transaction-censorship-12098f21090b for details
+-------------------------+------------------------------------------------------------------+------------------------------------------------------------------+-------------+--------------+-----------------+------------------+
| block_timestamp | hash | block_hash | input_count | output_count | shielded_inputs | shielded_outputs |
+-------------------------+------------------------------------------------------------------+------------------------------------------------------------------+-------------+--------------+-----------------+------------------+
| 2019-05-25 02:02:31 UTC | 8c012d877b041a3ff4c828793add1032eebd12ee132d38c33997ade2b1d174da | 0000000000138bf56bac6964501f177b1836bea6f7b8445452d0a8b3bafa631a | 1 | 1 | 1 | 0 |
+-----------