Skip to content

Instantly share code, notes, and snippets.

View weimeng23's full-sized avatar
🤩
Focusing

Meng Wei weimeng23

🤩
Focusing
  • Beijing
  • 15:32 (UTC +08:00)
View GitHub Profile
@weimeng23
weimeng23 / claude_3.5_sonnet_artifacts.xml
Created September 9, 2024 10:54 — forked from dedlim/claude_3.5_sonnet_artifacts.xml
Claude 3.5 Sonnet, Full Artifacts System Prompt
<artifacts_info>
The assistant can create and reference artifacts during conversations. Artifacts are for substantial, self-contained content that users might modify or reuse, displayed in a separate UI window for clarity.
# Good artifacts are...
- Substantial content (>15 lines)
- Content that the user is likely to modify, iterate on, or take ownership of
- Self-contained, complex content that can be understood on its own, without context from the conversation
- Content intended for eventual use outside the conversation (e.g., reports, emails, presentations)
- Content likely to be referenced or reused multiple times
@weimeng23
weimeng23 / build_boost.sh
Created August 27, 2024 06:22
build boost c++ lib
cd path/to/boost_1_82_0
./bootstrap.sh --help
./bootstrap.sh --prefix=path/to/installation/prefix
./b2 install
@weimeng23
weimeng23 / build_onnxruntime.sh
Last active August 21, 2024 02:56
Build ONNX Runtime with Execution Providers (cuda)
# GCC version must be greater than or equal to 9
# greater than or equal to python3.8
# cuda, cudnn need to be installed
curl -L -o onnxruntime-v1.16.3.tar.gz https://github.com/microsoft/onnxruntime/archive/refs/tags/v1.16.3.tar.gz
tar -zxvf onnxruntime-v1.16.3.tar.gz
cd onnxruntime-v1.16.3
# ./build.sh --use_cuda --cudnn_home /usr/local/cuda-11.8 --cuda_home /usr/local/cuda-11.8 --allow_running_as_root --skip_submodule_sync --parallel
# ./build.sh --config Release --use_cuda --cudnn_home /usr/local/cuda-11.8 --cuda_home /usr/local/cuda-11.8 --allow_running_as_root --skip_submodule_sync --parallel
@weimeng23
weimeng23 / install_gcc.sh
Last active August 20, 2024 07:47
compile && install gcc from source
# install bzip2
# sudo yum install -y bzip2
# sudo apt-get install -y bzip2
wget https://gcc.gnu.org/pub/gcc/releases/gcc-14.2.0/gcc-14.2.0.tar.gz
tar -zxvf gcc-14.2.0.tar.gz
cd gcc-14.2.0
./contrib/download_prerequisites
@weimeng23
weimeng23 / CentOS-Base.repo
Last active August 19, 2024 09:24
aliyun centos7 yum mirror repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
@weimeng23
weimeng23 / CMakeLists.txt
Last active September 14, 2024 05:58
Demo CMakeLists.txt for learning
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
# 设置项目名称
project(LearnCmake VERSION 1.0 LANGUAGES CXX)
# 添加可执行文件
add_library(add STATIC add.cc)
add_executable(main main.cc)
@weimeng23
weimeng23 / install_glibc.sh
Last active April 16, 2024 16:11
compile and install glibc in custom path
wget https://github.com/bminor/glibc/archive/refs/tags/glibc-2.35.tar.gz
tar xvf glibc-2.35.tar.gz
cd glibc-glibc-2.35
mkdir build
cd build
../configure --prefix=/path/to/install
make -j10
make install
@weimeng23
weimeng23 / logger.py
Created January 31, 2024 10:04
python useful logger
logger = logging.getLogger(__name__)
logger.setLevel(level=logging.DEBUG)
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
formatter = logging.Formatter('%(asctime)s | %(levelname)s | %(filename)s | %(threadName)s | %(funcName)s | %(lineno)s | %(message)s')
fh = logging.FileHandler("log.txt")
fh.setLevel(logging.INFO)
fh.setFormatter(formatter)
logger.addHandler(fh)
@weimeng23
weimeng23 / export_bert_onnx.py
Last active January 30, 2024 03:27
export onnx model
class MyBertForSequenceClassification(BertForSequenceClassification):
def forward(self, input_ids=None, attention_mask=None, token_type_ids=None):
outputs = super().forward(
input_ids=input_ids,
attention_mask=attention_mask,
token_type_ids=token_type_ids,
)
return outputs.logits
@weimeng23
weimeng23 / M365Princess.omp.json
Created November 29, 2023 03:40
oh my posh add conda Venv to prompt
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"palette": {
"white": "#FFFFFF",
"tan": "#CC3802",
"teal": "#047E84",
"plum": "#9A348E",
"blush": "#DA627D",
"salmon": "#FCA17D",
"sky": "#86BBD8",