Skip to content

Instantly share code, notes, and snippets.

View hawkingrei's full-sized avatar
:octocat:
I may be slow to respond.

Weizhen Wang hawkingrei

:octocat:
I may be slow to respond.
View GitHub Profile
@hawkingrei
hawkingrei / README.md
Created February 16, 2026 02:38
TiDB runtime error index out of range repro assets (case_0008)

TiDB out-of-range repro assets

1) Prepare

mysql --comments --host 127.0.0.1 --port 4000 -u root -e "select tidb_version()\G"

2) Reproduce

@hawkingrei
hawkingrei / semantic_search_with_gzip.py
Created July 16, 2023 14:17 — forked from kyo-takano/lexical_search_with_gzip.py
Semantic Search with gzip (gzipによるセマンティック検索)
import gzip
def gzip_search(query: str, candidate_chunks: list[str], top_k: int=1):
"""
文字列ベースで類似したテキストチャンクを推定するアルゴリズム.
`query`, `chunk`, および`query + " " + chunk`をそれぞれgzipで圧縮し、編集距離のようなものをベースに評価する.
Parameters:
query (str): 検索クエリとして使用する文字列.
top_k (int, optional): 返される類似チャンクの上位k個を指定する (default: 1).
@hawkingrei
hawkingrei / gist:10aa41d326cd143bd76fe98c7ffa32a0
Created June 3, 2022 12:02 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
-Xms128m
-Xmx8182m
-XX:ReservedCodeCacheSize=512m
-XX:CICompilerCount=2
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
-XX:+UnlockExperimentalVMOptions -XX:+UseZGC
-XX:ZCollectionInterval=120 -XX:ZAllocationSpikeTolerance=5
-XX:+UnlockDiagnosticVMOptions -XX:-ZProactive
-ea
@hawkingrei
hawkingrei / Matrix.md
Created September 3, 2021 06:12 — forked from nadavrot/Matrix.md
Efficient matrix multiplication

High-Performance Matrix Multiplication

This is a short post that explains how to write a high-performance matrix multiplication program on modern processors. In this tutorial I will use a single core of the Skylake-client CPU with AVX2, but the principles in this post also apply to other processors with different instruction sets (such as AVX512).

Intro

Matrix multiplication is a mathematical operation that defines the product of

@hawkingrei
hawkingrei / ast_vs_rpn.rs
Created March 6, 2020 10:30 — forked from breezewish/ast_vs_rpn.rs
AST vs RPN evaluation performance. JavaScript version: https://gist.github.com/koorchik/9717b893ae2134e21dbe
//! AST vs RPN evaluation performance in Rust language.
#![feature(test)]
extern crate test;
#[derive(Clone, Copy, Debug)]
pub enum Function {
Plus,
Minus,
@hawkingrei
hawkingrei / metadata_write.c
Last active May 5, 2019 03:35
metadata_write.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "webp/encode.h"
#include "./metadata.h"
int WebPMemoryWrite(const uint8_t *data, size_t data_size,
WebPMemoryWriter *const w)
{
@hawkingrei
hawkingrei / install-scylla-on-aws-with-dpdk.sh
Created September 2, 2018 13:40 — forked from dbathgate/install-scylla-on-aws-with-dpdk.sh
Installing ScyllaDB in AWS with DPDK enabled
# Installing ScyllaDB in AWS with DPDK enabled
# Prerequisites:
# - Red Hat Enterprise Linux 7.2 (HVM)
# - Instance type that supports enhanced networking (see http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking.html#enhanced_networking_instance_types)
# - Secondary NIC installed via Network Interfaces in AWS
# - Instance type with 2 hard drives for RAID0 array
########## DO THIS FIRST ################
# Fetch the latest linux kernel
yum update -y
@hawkingrei
hawkingrei / fork_example.cpp
Created August 23, 2017 03:11
fork in linux example
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv)
{
printf("--beginning of program\n");
int counter = 0;
pid_t pid = fork();
@hawkingrei
hawkingrei / gist:b838589633f7a68b28e56801203aa6a6
Created August 13, 2017 03:56 — forked from icecrime/gist:67399480c9a10b48fadc
An experiment with Golang reflection and channels
package main
import (
"reflect"
"strings"
)
func makeChannel(t reflect.Type, chanDir reflect.ChanDir, buffer int) reflect.Value {
ctype := reflect.ChanOf(chanDir, t)
return reflect.MakeChan(ctype, buffer)