Skip to content

Instantly share code, notes, and snippets.

View project-delphi's full-sized avatar
🎯
Focusing

Ravi Kalia project-delphi

🎯
Focusing
View GitHub Profile
@project-delphi
project-delphi / git-search-commits.sh
Created April 22, 2024 21:25
git commit history search playback
function git_history() {
local filename=$1
local search_string=$2
local lines=$3
local delay=$4
for commit in $(git rev-list HEAD -- "$filename" | tail -r); do
clear
echo "Commit: $commit, Author: $(git log -1 --pretty=format:'%an' --date=format:'%d-%m-%Y' $commit), Date: $(git log -1 --pretty=format:'%ad' --date=format:'%d-%m-%Y' $commit)"
git show $commit:"$filename" | grep -n -A "$lines" -B "$lines" "$search_string" | awk '/--/ && !f{printf "\033[1;34m"; for(i=0;i<70;i++)printf "-"; printf "\033[0m\n"; f=1; next} /--/{f=0} 1'
import torch
import networkx as nx
def adjacency_statistics(adjacency_matrix):
"""
Compute canonical measures of a graph represented by an adjacency matrix.
Args:
- adjacency_matrix: PyTorch tensor representing the adjacency matrix of the graph
@project-delphi
project-delphi / pytorch_geometric_apple_silicon_developer_install.sh
Last active March 20, 2024 16:40
pytorch geometric developer install on Apple Silicon
# set variables here
DIR="$HOME/Code/throwaway/pytorch-geometric-developer-install"
PYTHON_VERSION=3.11
RECENT_TORCH_VERSION=2.2.0
GITHUB_USERNAME="project-delphi"
MIN_MACOSX_DEPLOYMENT_TARGET=$(sw_vers -productVersion)
# install miniconda for apple silicon, if not already installed
if [ ! -d "$HOME/anaconda3" ] && [ ! -d "$HOME/miniconda3" ]
then
@project-delphi
project-delphi / pyg_user_install.sh
Last active March 20, 2024 16:06
This script sets up a Python virtual environment and installs PyTorch and PyTorch Geometric for Apple Silicon
# set variables here
DIR="$HOME/Code/throwaway/pytorch-geometric-user-install"
PYTHON_VERSION=3.11
RECENT_TORCH_VERSION=2.2.0
# install miniconda for apple silicon, if not already installed
if [ -d "$HOME/anaconda3" ] || [ -d "$HOME/miniconda3" ]
then
echo "Conda is installed"
else
@project-delphi
project-delphi / Makefile
Created June 5, 2023 21:13
Example Makefile used for Python CI
SHELL := /bin/bash
.PHONY: venv
venv:
python3 -m venv .venv &&\
source ./.venv/bin/activate
.PHONY: install
install:
pip install --upgrade pip &&\