Skip to content

Instantly share code, notes, and snippets.

View khnshn's full-sized avatar
🎯

Alireza Khanshan khnshn

🎯
View GitHub Profile
@khnshn
khnshn / confusion_matrix.py
Created July 20, 2023 08:29
TPR, TNR, PPV, NPV, FPR, FNR, FDR, ACC
def perf_measure(y_actual, y_hat):
TP = 0
FP = 0
TN = 0
FN = 0
for i in range(len(y_hat)):
if y_actual[i] == y_hat[i] == 1:
TP += 1
if y_hat[i] == 1 and y_actual[i] != y_hat[i]:
@khnshn
khnshn / bibmerger.py
Last active November 2, 2023 10:48
Search for .bib files in a directory and merge them where the unique id is (entry type, entry label).
import os
import argparse
import bibtexparser
# Create the parser
parser = argparse.ArgumentParser(
description="Search for .bib files in a directory and merge them."
)
# Add the arguments
parser.add_argument("Dir", metavar="dir", type=str, help="the directory to search")
@khnshn
khnshn / set_date.txt
Created February 11, 2024 21:30
Linux CLI set date to current datetime
sudo date -s "$(wget --method=HEAD -qSO- --max-redirect=0 google.com 2>&1 | sed -n 's/^ *Date: *//p')"
@khnshn
khnshn / create_gamebus_users.py
Last active March 19, 2024 13:57
A script to create (sign up) GameBus players
import requests
import json
import time
import pandas as pd
import sys
if len(sys.argv) != 2:
print("Invalid arguments")
exit(0)
else:
@khnshn
khnshn / .vimrc
Created April 20, 2025 17:59
my vimrc
set number
set relativenumber
set cursorline
set cursorcolumn
set colorcolumn=80
syntax on
set hlsearch
set incsearch
set showmatch
set foldmethod=syntax