Skip to content

Instantly share code, notes, and snippets.

View kocubinski's full-sized avatar

Matt Kocubinski kocubinski

View GitHub Profile
@kocubinski
kocubinski / iavl-v2-design.org
Last active October 26, 2023 21:03
iavl v2 design

IAVL v2 design

1 folder per module prefix, each with 2 databases, changelog.db and tree.db. storekey defaults to “root” for a single tree implementation.

receive changeset, write leaves to leaf table in changelog.db, always. this table contains a btree index. the writes are append only on the end.

@kocubinski
kocubinski / qemu-winxp.sh
Created January 16, 2023 15:58 — forked from ljmccarthy/qemu-winxp.sh
QEMU command line for Windows XP
#!/bin/sh
exec qemu-system-i386 -enable-kvm -cpu host -m 1024 -vga std -soundhw ac97 -net nic,model=rtl8139 \
-net user -drive file=winxp.img,format=raw -drive file=/usr/share/virtio/virtio-win.iso,media=cdrom
@kocubinski
kocubinski / intermodule-deps.txt
Created August 23, 2022 21:31
cosmos-sdk intermodule dependencies `main` 2022-08-23
/x/auth/ante/feegrant_test.go -> /x/feegrant/errors.go
/x/auth/client/testutil/suite.go -> /x/bank/client/cli/tx.go
/x/auth/client/testutil/suite.go -> /x/bank/types/msgs.go
/x/auth/client/testutil/suite.go -> /x/gov/client/testutil/helpers.go
/x/auth/client/testutil/suite.go -> /x/bank/types/query.pb.go
/x/auth/client/testutil/suite.go -> /x/bank/types/tx.pb.go
/x/auth/client/testutil/suite.go -> /x/genutil/client/cli/init.go
/x/auth/client/testutil/suite.go -> /x/gov/types/v1beta1/proposal.go
/x/auth/exported/exported.go -> /x/params/types/paramset.go
/x/auth/keeper/msg_server.go -> /x/gov/types/errors.go
@kocubinski
kocubinski / exercise.scm
Created May 9, 2020 22:38
Exercise 1.11 from SICP
(define (f-11-tree n)
(define (f n depth)
(println-depth depth n)
(if (< n 3)
n
(+ (f (- n 1) (inc depth))
(* 2 (f (- n 2) (inc depth)))
(* 3 (f (- n 3) (inc depth))))))
(f n 0))
(ns moon-moon.core
(:require [clojure.java.io :as io]
[clojure.string :as str]))
(defn rand-words
[]
(with-open [reader (io/reader "/usr/share/dict/words")]
(->> (line-seq reader)
(filter (partial re-matches #"[a-z]{0,7}"))
(partial rand-nth)
@kocubinski
kocubinski / hostWorkspace.groovy
Last active December 4, 2018 03:42
Return the host's path of a Jenkins WORKSPACE running a docker container.
import groovy.json.JsonSlurper;
def call(String workspace) {
def p = ['/bin/bash', '-c', '''
docker ps --no-trunc --all \
| grep `cat /etc/hostname` \
| grep jenkins.sh \
| awk '{print $1}' \
| xargs docker inspect
'''].execute()
@kocubinski
kocubinski / moon-moon.clj
Created July 13, 2018 14:32
generate random words
(ns moon-moon.core
(:require [clojure.java.io :as io]
[clojure.string :as str]))
(defn rand-words
[]
(with-open [reader (io/reader "/usr/share/dict/words")]
(->> (line-seq reader)
(filter (partial re-matches #"[a-z]{0,7}"))
(partial rand-nth)
@kocubinski
kocubinski / windows10qemu.sh
Created July 30, 2017 18:35 — forked from Manouchehri/windows10qemu.sh
Running Windows 10 in a UEFI enabled QEMU environment with KVM.
# Installing
qemu-system-x86_64 -bios /usr/share/ovmf/ovmf_x64.bin -enable-kvm -cpu host -smp 4 -m 2048 -cdrom ~/Downloads/Win10_English_x64.iso -net nic,model=virtio -net user -drive file=~/vm/win10.hd.img.raw,format=raw,if=virtio -vga qxl -drive file=~/Downloads/virtio-win-0.1.105.iso,index=1,media=cdrom
# Running
qemu-system-x86_64 -bios /usr/share/ovmf/ovmf_x64.bin -enable-kvm -cpu host -smp 4 -m 4096 -net nic,model=virtio -net user -drive file=~/vm/win10.hd.img.raw,format=raw,if=virtio -vga qxl -usbdevice tablet -rtc base=utc
@kocubinski
kocubinski / js-questions.js
Created April 29, 2016 18:51
Javascript questions
// Function closures:
var fn = function(x) {
return function() { return x = x + 1; };
};
var fn2 = fn(2);
// Q. What is stored in the variable fn2?
// A. A function which, when called, increments x by 1 and returns the result.
// A common mistake is to think it returns either 2, or 3.