Skip to content

Instantly share code, notes, and snippets.

@joe32140
joe32140 / evaluate_code_tasks.py
Last active April 16, 2025 05:22
Code Retrieval Model Evaluation On COIR with MTEB Library
"""
Evaluate and compare multiple code retrieval models on various MTEB code-related tasks.
Uses only the recommended subset of CoIR tasks based on provided analysis.
"""
import os
import argparse
import logging
import json
import pandas as pd
from sentence_transformers import SentenceTransformer
@joe32140
joe32140 / convert_cochrane_id_to_pmcid.py
Last active June 27, 2023 22:16
Convert Cochrane id to PubMed id in python
import requests
def convert_cochrane_id_to_pmcid(cochrane_id):
# Define the base URL for the Entrez E-utilities API
base_url = "https://eutils.ncbi.nlm.nih.gov/entrez/eutils/"
# Define the search term
search_term = cochrane_id
# Construct the API request URL
@joe32140
joe32140 / Home_End.md
Created August 9, 2021 16:14
Add keyboard shortcut to VS Code on Macbook

Adding the following setting to Preference -> Keyboard Shortcuts in VS code

[
    {
        "key": "home",
        "command": "workbench.action.terminal.sendSequence",
        "args": { "text": "\u0001" },   // move cursor to end of line, bash at least
        "when": "terminalFocus"
      },
 {
@joe32140
joe32140 / readme.md
Last active April 24, 2021 15:44
Failed to initialize NVML: Driver/library version mismatch

Situation

Once in a while, we will get Failed to initialize NVML: Driver/library version mismatch when we call nvidia-smi.

Problem

This is because we set up automatic unbuntu security update and result in mismatch between versions of run-time driver version and installed driver.

# Check run-time driver version 
cat /proc/driver/nvidia/version 

# Check install nvidia driver version

Run tmux source .tmux.conf when building new envirenment

@joe32140
joe32140 / Conda.md
Last active April 18, 2021 04:56
Build up new server

Create datausers group and add users into it

sudo groupadd datausers
usermod -a -G datausers USERNAME

add data/ dir in root

change permission to all users for anaconda dir change gourp owner of pkgs/

@joe32140
joe32140 / Add-ssh-key.md
Last active December 14, 2019 22:08
add ssh key to remote server

1. Make sure both ends have ssh key. If not, run:

ssh-keygen -t rsa

2. At local machine, run:

cat ~/.ssh/id_rsa.pub | ssh user@remotehost 'cat >> .ssh/authorized_keys'
@joe32140
joe32140 / .zshrc
Last active December 16, 2020 05:36
My zshrc
##ANTIGEN
if ! [[ -d ~/.config ]]
then
bash ~/my_dotfiles/setup.sh
fi
GEN_HOME=$HOME/.zgen
if ! [[ -d $GEN_HOME ]]
then
git clone https://github.com/tarjoilija/zgen.git $GEN_HOME
@joe32140
joe32140 / Git Cheat sheet.md
Last active November 30, 2019 00:36
Git Cheat sheet

Fetch files from forked repository without replacing origin files

git remote add GIVE_IT_A_NAME GITHUB_LINK
git fetch GIVE_IT_A_NAME
git checkout GIVE_IT_A_NAME/BRANCH -- path/to/files/or/dir/from/root/of/repo

# example, it will update the new slides
git remote add remote https://github.com/BoulderDS/CSCI5622-machine-learning
git fetch remote
@joe32140
joe32140 / Regular Expression Cheat Note.md
Last active April 30, 2019 09:27
Speech and Language Processing Reading Note

Exact Match

RE Example Patterns Matched
/woodchucks/ “interesting links to woodchucks and lemurs”
/a/ “Mary Ann stopped by Mona’s”
/!/ “You’ve left the burglar behind again!” said Nori

Disjunction

The use of the brackets [] to specify a disjunction of characters