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))
@kocubinski
kocubinski / FileSystemCache.cs
Created January 13, 2016 17:05
A simple write-invalidated cache for JSON on the file system.
public interface ICache<out T>
{
T Get(string key);
}
public class CacheObject<T>
{
public T Value { get; set; }
public DateTime CachedDate { get; set; }
@kocubinski
kocubinski / cprint.clj
Created May 12, 2013 16:23
ClojureCLR println with colors in Windows cmd.exe
(assembly-load "ClojureClrEx")
(ns clync.core
(:use [clojure.clr.pinvoke :only [dllimports]]))
(dllimports
"Kernel32.dll"
(GetStdHandle IntPtr [Int32])
(SetConsoleTextAttribute Boolean [IntPtr UInt32]))
(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)