Skip to content

Instantly share code, notes, and snippets.

View skyzh's full-sized avatar

Alex Chi Z. skyzh

View GitHub Profile

MiniLSM: A Tutorial of Building Storage Engine in a Week using Rust

MiniLSM is a working-in-progress tutorial series for building a storage engine. Based on the experience of building AgateDB and RisingWave, MiniLSM introduces you the basics of an LSM-tree storage engine with a step-by-step tutorial.

The starter code is accessible on GitHub, and the tutorial is available on GitHub Pages.

What is LSM, and Why LSM?

skyzh /
Created September 2, 2021 09:45
Demo of ArrayBuilder, Array and Datatype in Rust
trait ArrayBuilder {
type ArrayType: Array<Builder = Self>;
fn new(capacity: usize) -> Self;
fn append<'a>(
&'a mut self,
value: Option<<<Self as ArrayBuilder>::ArrayType as Array>::RefItem<'a>>,
skyzh /
Last active January 7, 2021 09:33
import requests
from pathlib import Path
import time
import re
import base64
from lxml import etree
import os
from io import BytesIO
def gen_random_file(size):
skyzh / index.js
Created January 17, 2020 14:26
Generate .ics file from course table
View index.js
const data = require('./data.json')
const debug = require('debug')('generator')
const _ = require('lodash')
const ics = require('ics')
const moment = require('moment')
const fs = require('fs')
const courses = data.kbList.filter(course => !course.ignore).map(course => ({
name: course.kcmc,
teacher: course.xm,
skyzh / blackbox_exporter.json
Created November 29, 2019 14:12
Grafana Dashboard for Blackbox Exporter
View blackbox_exporter.json
"__inputs": [
"name": "DS_PROMETHEUS",
"label": "Prometheus",
"description": "",
"type": "datasource",
"pluginId": "prometheus",
"pluginName": "Prometheus"
skyzh / huffman.cpp
Created November 17, 2019 10:17
Huffman Encoding
View huffman.cpp
#include <iostream>
#include <fstream>
#include <map>
#include <algorithm>
#include <queue>
#include <string>
using namespace std;
struct Node {
skyzh / CE.cpp
Created October 15, 2019 11:05
Templated parameter with default value will throw compile error.
View CE.cpp
#include <iostream>
#include <functional>
using namespace std;
template <typename T>
bool compare_by_value(const T& a, const T& b) { return a < b; }
template <typename Comp>
bool alex_compare_int(const int& a, const int &b, Comp comp = compare_by_value) {
skyzh / index.html
Created July 25, 2019 01:02
Use d3.js to visualize collision between point and segment
View index.html
<!DOCTYPE html>
<title>Physics Test</title>
<svg id="main" width="800" height="800"></svg>
<script src=""></script>
<script src="main.js"></script>
skyzh / contest_1_strategy.hpp
Last active July 25, 2019 11:31
PPCA 2019 Contest B Solution
View contest_1_strategy.hpp
#include <vector>
#include <cstdlib>
#include <ctime>
#include "util.hpp"
#include <vector>
int cnt = 0;
View bst_interval.cpp
#include <iostream>
#include <climits>
#include <cstring>
using namespace std;
template<typename T>
struct BST {
struct Node {
T x;