Skip to content

Instantly share code, notes, and snippets.

work work work

Alex Chi Z. skyzh

work work work
View GitHub Profile
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"

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 / index.js
Created December 23, 2017 03:21
Export Anki cards to HTML
View index.js
How to use?
Install Node.js and run 'npm init', than install the dependency 'lodash'.
Install the Anki addon from '', and export your deck to JSON.
Run 'node index.js', and there will be a generated 'index.html'.
const _ = require('lodash');
const fs = require('fs');
skyzh / class_generator.js
Last active September 9, 2021 02:58
Use predefined file to generate class table.
View class_generator.js
const data = require('./data');
const _ = require('lodash');
const moment = require('moment');
const ics = require('ics');
const fs = require('fs');
const timePeriod = (date, from, to) => {
const _from = moment(`${date} ${[from - 1]}:00`);
const _end = moment(`${date} ${[to - 1]}:00`).add(data.timetable.length, 'minute');
return [_from, _end];
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 / 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 / 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;