Skip to content

Instantly share code, notes, and snippets.

@link89
link89 / mace-training.md
Last active December 26, 2025 02:03
mace model training tips

Bug fix

Prepare Data

mace_prepare_data doesn't support loading multiple file by glob, which make it almost impossible to use it to prepare data. This PR can fix the problem: ACEsuit/mace#1313

After applying the PR, one can use the following command to prepare data

mkdir -p dataset
@link89
link89 / activate-mps.sh
Created December 23, 2025 08:39
Nvidia MPS activate script for slurm
#!/bin/bash
env | grep CUDA_
export CUDA_MPS_PIPE_DIRECTORY=$HOME/.nv_mps/$SLURM_JOB_ID/pipe
export CUDA_MPS_LOG_DIRECTORY=$HOME/.nv_mps/$SLURM_JOB_ID/log
mkdir -p $CUDA_MPS_PIPE_DIRECTORY $CUDA_MPS_LOG_DIRECTORY
cleanup_mps() {
echo "shutdown MPS server ..."
@link89
link89 / build-gmx-deepmd.sh
Last active December 19, 2025 12:43
Build gromacs with deepmd support
#!/bin/bash
set -e
source ./activate
module load gcc/9.3
module load cmake/3.21
# module unload gcc
[ -d gromacs-2020.2 ] || {
wget http://ftp.gromacs.org/pub/gromacs/gromacs-2020.2.tar.gz
#!/bin/bash
set -e
# create conda environment
module load miniconda
module load cuda/12.4
module load gcc/14.2
export CONDA_OVERRIDE_CUDA=12.6 # this is essential for deepmd-kit
@link89
link89 / tcp-keepalive.sh
Created December 8, 2025 02:58
A crontab script to test and keep tcp tunnel alive.
#!/bin/bash
TARGET_LIST=(
"127.0.0.1 22001"
"127.0.0.1 22002"
"127.0.0.1 22003"
)
LOG_FILE=~/log/tcp_keep_alive.log
TIMEOUT_BIN=/usr/bin/timeout
@link89
link89 / bs-clean-maps.py
Last active October 1, 2025 06:38
A python script to clean orphan Beatsaber custom maps for Meta (Oculus) Quest device
import subprocess
import json
import os
import glob
import sys
# --- User Configuration ---
# 1. Path to the adb executable.
ADB_PATH = "adb"
# You may change it if adb command cannot be found, e.g.
@link89
link89 / build.sh
Created March 25, 2025 07:40
Script to build libbeef and its modulefile
#!/bin/bash
set -e
[ -f build.done ] || {
module purge
module add compiler/2022.0.1
./configure CC=icc --prefix=/data/share/lib/libbeef/latest --enable-optmax
make
sudo make install
@link89
link89 / cuda-troubleshoot.sh
Created February 8, 2025 02:07
A quick test for troubleshooting CUDA enviornment issue
#/bin/bash
set -e
# Hello world test
cat <<EOF > hello.cu
#include <stdio.h>
__global__ void helloFromGPU(void) {
printf("Hello World from GPU!\n");
}
@link89
link89 / build.sh
Created January 9, 2025 03:28
An example of building deempd 3.0+ with conda & cuda 12 on rocky linux 8.5+
#!/bin/bash
set -e
# reset environment
conda deactivate || true
module purge
export OPENBLAS_NUM_THREADS=16
SCRIPT_PATH=$(realpath $0)
@link89
link89 / st_ext.py
Last active December 2, 2025 06:31
Cookie based session for Streamlit
from streamlit.web.server.websocket_headers import _get_websocket_headers
from streamlit.components.v1 import html
import streamlit as st
from http.cookies import SimpleCookie
from uuid import uuid4
from time import sleep
def get_cookie():