Skip to content

Instantly share code, notes, and snippets.

@coin3x
coin3x / appuru-btrie.md
Last active April 24, 2024 12:39
我不會英文

appuru-btrie

This document describes a file format for storing a variant of Burst Trie (henceforth mentioned as btrie). This file format is used in MacOS's DictionaryServices.framework and some built-in libraries like libgermantok and libmecab. (Some offsets seem to be different.)

btrie

btrie is a trie data structure that stores a set of strings (byte sequences). Each edge represents a byte, and the represented string of a node is the concatenation of all edges walked from the root node. Children of each node

--[[
Prefer the text one if there exist an image subtitle in English and a text subtitle in English
]]--
mp.register_event('file-loaded', function()
local count = mp.get_property_number('track-list/count')
local en_subs = {}
for i = 0,(count - 1) do
local prefix = 'track-list/'..tostring(i)
#!/usr/bin/env zx
import path from 'path';
const DevicesRoot = '/sys/bus/usb/devices';
async function getDevices() {
let origDevicePaths = (await fs.readdir(DevicesRoot))
.map(id => path.join(DevicesRoot, id))
let devices = [];
const { parse } = require("@babel/parser");
const { default: traverse } = require("@babel/traverse");
const { default: generate } = require("@babel/generator");
const t = require("@babel/types");
const fs = require('fs');
const ConstantFolding = require('babel-plugin-minify-constant-folding');
const ConsecutiveAdds = require('babel-plugin-transform-inline-consecutive-adds')
const Linter = require('eslint').Linter;
let ast = parse(fs.readFileSync('main.js', 'utf-8'));