Skip to content

Instantly share code, notes, and snippets.

View vejvarm's full-sized avatar

Martin Vejvar vejvarm

  • Yokohama National University
  • Japan
  • 05:29 (UTC +09:00)
View GitHub Profile
import json
import os
import re
import sqlite3
import asyncio
import threading
from typing import Tuple, Any, List, Set
from itertools import product
from collections import defaultdict
from concurrent.futures import ThreadPoolExecutor
@vejvarm
vejvarm / exec_eval_multiprocessing.py
Created December 11, 2024 07:06
exec eval using RDFlib and multiprocessing
import json
import os
import re
import sqlite3
import asyncio
import multiprocessing
from typing import Tuple, Any, List, Set
from itertools import product, chain
from collections import defaultdict
from concurrent.futures import ProcessPoolExecutor # Use ProcessPoolExecutor instead of ThreadPoolExecutor
@vejvarm
vejvarm / ms-amp-installation.sh
Last active October 30, 2024 07:21
Installing MS-AMP to a local conda environment (needs sudo rights)
# create new local conda env
conda create --prefix ./.conda python=3.11
conda activate ./.conda
# https://azure.github.io/MS-AMP/docs/getting-started/installation/
git clone https://github.com/Azure/MS-AMP.git
cd MS-AMP
git submodule update --init --recursive
cd third_party/msccl
@vejvarm
vejvarm / repl_var_names.cy
Created May 9, 2024 05:30
repl_var_names
MATCH (T1:ROOT__endowment)
MATCH (T2:ROOT__school)
WHERE (T2_school_name = 'Glenn')
RETURN DISTINCT count(DISTINCT T1.endowment__donator_name) AS aggregation_ T1.endowment__donator_name _106
@vejvarm
vejvarm / ast.json
Created May 9, 2024 02:59
Complex Parser example with FILTER, HAVING, GROUP BY and conditional operators (&&/||)
{
"sPREFIX": {},
"RETURN": [
"T1_school_name"
],
"TRIPLES": {
"T1": {
"label": "ROOT__school",
"school__school_name": "T1_school_name"
},
@prefix : <http://valuenet/ontop/> .
@prefix budget: <http://valuenet/ontop/budget#> .
@prefix endowment: <http://valuenet/ontop/endowment#> .
@prefix school: <http://valuenet/ontop/school#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://valuenet/ontop/budget/school_id=1;year=2003> a :budget ;
budget:SCHOOL_ID <http://valuenet/ontop/school/school_id=1> ;
budget:budget_invested_percent "71.3" ;
budget:budgeted 119527 ;
{
"RETURN": [
"DISTINCT",
"*"
],
"TRIPLES": {
"T1": {
"label": "ROOT__projects",
"projects__project_details": "T1_project_details",
"projects__project_id": "T1_project_id"
@vejvarm
vejvarm / cuda_12.2_installation_on_Ubuntu_20.04
Last active January 24, 2025 01:50 — forked from MihailCosmin/cuda_11.8_installation_on_Ubuntu_22.04
Instructions for CUDA v12.2 and cuDNN 8.7 installation on Ubuntu 20.04 for PyTorch 2.0.0
#!/bin/bash
### steps ####
# verify the system has a cuda-capable gpu
# download and install the nvidia cuda toolkit and cudnn
# setup environmental variables
# verify the installation
###
### to verify your gpu is cuda enable check
import pathlib
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def read_data(path_to_csv):
df = pd.read_csv(path_to_csv, skiprows=3)
unit = df.iloc[:, 1].name.split("(")[-1][:-1]