Skip to content

Instantly share code, notes, and snippets.

@ChunMinChang
ChunMinChang / dav1d-install.md
Created November 9, 2023 01:16
one-stop manual for dav1d installation

How to install dav1d

Here is the one-stop manual. For more details (or latest information), please check https://code.videolan.org/videolan/dav1d.

Prerequirement

dav1d relies on meson build system (and ninja), so meson installation is required. It might be best to see https://mesonbuild.com/ to know how to do it, but here are the steps:

  1. Run $ sudo apt-get install python3 python3-pip python3-setuptools python3-wheel ninja-build
  2. Run $ pip3 install meson (as root)
    • This is the best way to get the latest version of Mesonbuild. Due to our frequent release cycle and development speed, distro packaged software may quickly become outdated.
@ChunMinChang
ChunMinChang / testing-multi-gum.html
Created October 19, 2022 18:03
Test page for multi-mics in WebAudio, created by Paul Adenot
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"><meta charset="utf-8">
<style>
* {
box-sizing: border-box;
}
.wrapper {
border: 1px dashed black;
padding: 1em;
max-width: 50vw;
@ChunMinChang
ChunMinChang / fill_region.rs
Created September 14, 2020 00:22
Fill the region formed by same-color cell with a new color
#[derive(Clone, Debug, PartialEq)]
enum Color {
R,
Y,
G,
}
#[derive(Clone, PartialEq)]
enum Direction {
Up,
@ChunMinChang
ChunMinChang / gdb.md
Last active December 19, 2022 17:10
Debugging gecko with gdb

Debugging gecko with gdb

Setup gecko-dev/.gdbinit

Suppose the gecko folder is /home/cm/Work/gecko-dev

Add the following lins to your /home/cm/Work/gecko-dev/.gdbinit

add-auto-load-safe-path /home/cm/Work/gecko-dev/build/.gdbinit
@ChunMinChang
ChunMinChang / copy_file.cpp
Last active May 28, 2020 18:15
Read file into byte array
// image is from: https://github.com/rust-lang/rust/issues/11562
#include <assert.h> // assert
#include <fstream> // std::ifstream
#include <vector> // std::vector
std::vector<char> file_to_bytes(const char* filename) {
// Seek to the end in advance to get the file size in an easier way.
std::ifstream ifs(
filename, std::ifstream::in | std::ifstream::binary | std::ifstream::ate);
@ChunMinChang
ChunMinChang / HStringReference.cpp
Created May 21, 2020 17:07
Test sample for HString stuff
// References:
// https://docs.microsoft.com/en-us/cpp/cppcx/wrl/how-to-activate-and-use-a-windows-runtime-component-using-wrl?view=vs-2019
// https://chromium.googlesource.com/chromium/src/+/master/base/win/hstring_reference_unittest.cc
// This is compiled by: `$HOME/.mozbuild/clang/bin/clang-cl.exe HStringReference.cpp`
// or `cl.exe HStringReference.cpp runtimeobject.lib` in `Developer Command Prompt`
#include <assert.h> // assert
#include <wchar.h> // wcscmp
#include <wrl\wrappers\corewrappers.h> // HStringReference
@ChunMinChang
ChunMinChang / Linux.md
Last active February 28, 2024 18:35
Building gecko

Building Firefox on Linux

Get [mozilla-central][mozilla-central] via [git-cinnabar][cinnabar]

  1. Check if git is installed in your system
  2. Open terminal
    # Clone your own gecko repository
    git clone https://github.com/<your_username>/gecko-dev.git
    
@ChunMinChang
ChunMinChang / get_property_player.sh
Last active August 17, 2020 22:01
mpris utils scripts
#!/bin/sh
# example: sh get_property_player.sh CanPlay/CanSeek/CanGoNext/Rate/...
# get first mpris interface
bus=$(dbus-send --session \
--dest=org.freedesktop.DBus \
--type=method_call \
--print-reply=literal \
/org/freedesktop/DBus \
@ChunMinChang
ChunMinChang / Makefile
Last active March 20, 2020 15:50
A <Key, Value> LRU sample
# Build C++ client example
# Process with GNU make
all: test
check: all
./test
HEADER := lru_table.h
CXXFLAGS = -g -Wall -std=c++17 -fsanitize=address -DLRU_TABLE_DEBUG=1
@ChunMinChang
ChunMinChang / Makefile
Last active March 20, 2020 15:44
A Simple LRU Sample
# Build C++ client example
# Process with GNU make
all: test
check: all
./test
HEADER := lru.h
CXXFLAGS = -g -Wall -std=c++17 -fsanitize=address -DLRU_DEBUG=1