Skip to content

Instantly share code, notes, and snippets.

View cs-qyzhang's full-sized avatar

张丘洋 cs-qyzhang

View GitHub Profile
#include <stdio.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <linux/nvme_ioctl.h>
#include <liburing.h>
@cs-qyzhang
cs-qyzhang / double.bpf.c
Last active July 20, 2023 14:04
ubpf library example
// https://klyr.github.io/posts/playing_with_ubpf/
// clang -target bpf -I/usr/include/x86_64-linux-gnu -O2 -g -c double.bpf.c -o double.bpf.o
static int idouble(int a) {
return (a * 2);
}
int bpf_prog(void *ctx) {
int a = *(int *)ctx;
a = idouble(a);
@cs-qyzhang
cs-qyzhang / obsidian_to_jekyll.py
Last active January 13, 2023 13:02
Transform Obsidian notes to Jekyll posts, see https://jianyue.tech/posts/obsidian-to-jekyll/
# -*- coding: UTF-8 -*-
# obsidian notes -> jekyll posts
#
# python obsidian_to_jekyll.py --help
# python obsidian_to_jekyll.py -w -c -p
# python obsidian_to_jekyll.py --print
import argparse
import os
import pathlib
#include <iostream>
#include <fstream>
#include <vector>
#include "pin.H"
using std::cerr;
using std::ofstream;
using std::ios;
using std::string;
using std::endl;
{
"terminal.integrated.profiles.windows": {
"Visual Studio PowerShell": {
"source": "PowerShell",
"icon": "terminal-powershell",
"args": [
"-noe",
"-c",
"&{Import-Module 'C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Common7\\Tools\\Microsoft.VisualStudio.DevShell.dll';Enter-VsDevShell 2eff9869 -DevCmdArguments '-arch=x64 -no_logo' -StartInPath ${workspaceFolder}}"
]
@cs-qyzhang
cs-qyzhang / nvdimm_counter.c
Created October 28, 2021 12:58
Get Intel Optane DC PMM Hardware (Performance) Counter using libipmctl
// apt install libipmctl-dev
// gcc -o nvdimm_counter nvdimm_counter.c -lipmctl
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
// libipmctl includes
#include <nvm_types.h>
#include <nvm_management.h>
#include <export_api.h>
@cs-qyzhang
cs-qyzhang / data-generator.go
Created August 31, 2020 06:41
快速生成大量不重复的随机数序列
package main
import (
"bytes"
"container/list"
"fmt"
"hash/fnv"
"math/rand"
"os"
"strconv"