Skip to content

Instantly share code, notes, and snippets.

View YangKeao's full-sized avatar
👨‍🏭
working

YangKeao YangKeao

👨‍🏭
working
View GitHub Profile
@YangKeao
YangKeao / main.go
Created May 11, 2024 07:48
A simple `select_random_points` benchmark.
package main
import (
"bufio"
"context"
"database/sql"
"encoding/binary"
"flag"
"fmt"
"math/rand"
@YangKeao
YangKeao / main.c
Last active April 24, 2024 02:39
Test TiDB `SEND_LONG_LONG` protocol implementation
#include <mysql/mysql.h>
#include <stdio.h>
#include <string.h>
int insert_with_config(char* encoding, bool send_with_long) {
MYSQL *con = mysql_init(NULL);
if (con == NULL) {
fprintf(stderr, "%s\n", mysql_error(con));
return 1;
}
@YangKeao
YangKeao / main.go
Created August 28, 2023 08:47
A Go program to test whether the "weight_string" of an unicode character is the same between TiDB and MySQL.
package main
import (
"context"
"database/sql"
"fmt"
"os"
"sync"
_ "github.com/go-sql-driver/mysql"
@YangKeao
YangKeao / main.go
Last active June 8, 2023 09:26
Analyze all usage of `sessionctx.Context` in the "tidb/expression" package.
package main
import (
"fmt"
"go/ast"
"go/token"
"go/types"
"log"
"strings"
@YangKeao
YangKeao / corplink.nix
Created April 26, 2022 13:40
A package for Feilian on Nix OS
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/fs.h>
#include <linux/tracepoint.h>
#include <asm/syscall.h>
#include <linux/sched.h>
#include <linux/fdtable.h>
#include <linux/slab.h>
#include <linux/delay.h>
@YangKeao
YangKeao / main.go
Created March 25, 2021 06:27
Kubernetes Application OpenID PoC
package main
import (
"context"
"encoding/json"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
"log"
"net/http"
"os"
@YangKeao
YangKeao / main.rs
Created January 6, 2021 08:15
simple frame pointer perf example
use std::{mem::size_of, ptr::{null, null_mut}};
use libc::c_void;
use perf_event_open_sys as sys;
fn main() -> std::io::Result<()> {
let mut attrs = sys::bindings::perf_event_attr::default();
// Populate the fields we need.
attrs.size = std::mem::size_of::<sys::bindings::perf_event_attr>() as u32;
attrs.type_ = sys::bindings::perf_type_id_PERF_TYPE_HARDWARE;
@YangKeao
YangKeao / usbkbd.diff
Last active March 27, 2019 14:20
usbkbd.diff
From b190103978a60cca75ccf846cf082a00b1eb6f8c Mon Sep 17 00:00:00 2001
From: Yang Keao <keao.yang@yahoo.com>
Date: Wed, 27 Mar 2019 21:12:17 +0800
Subject: [PATCH] Modify USBKBD
---
drivers/hid/usbhid/usbkbd.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/hid/usbhid/usbkbd.c b/drivers/hid/usbhid/usbkbd.c
@YangKeao
YangKeao / dwm-shakecursor-6.1.diff
Last active March 18, 2019 15:42
DWM shake and find cursor
From 4beb792e846212d6eac1b7f7bfe49d91128bbe43 Mon Sep 17 00:00:00 2001
From: Yang Keao <keao.yang@yahoo.com>
Date: Mon, 18 Mar 2019 23:12:01 +0800
Subject: [PATCH 1/2] Map window when shake cursor
---
dwm.c | 26 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)
diff --git a/dwm.c b/dwm.c