Skip to content

Instantly share code, notes, and snippets.

@SiLiKhon
SiLiKhon / get_density_from_diffusion.py
Created November 21, 2023 07:22
SAMOS density calculation
from typing import Iterable
import numpy as np
from ase.io import read
from ase.atoms import Atoms
from samos.trajectory import Trajectory
from samos.analysis.get_gaussian_density import get_gaussian_density
def calculate_gaussian_density(
@SiLiKhon
SiLiKhon / venv_detector.sh
Last active February 19, 2026 05:35
Simple bash function to detect venvs below the current directory.
#!/bin/bash
venvs() {
local DEPTH=3
local OPTIND=1
while getopts "l:" opt; do
case $opt in
l) DEPTH="$OPTARG" ;;
esac
done
@SiLiKhon
SiLiKhon / define_directory_hash.sh
Last active April 24, 2026 04:18
Defines bash function for recursive hashsum calculation over a directory
directory_hash() {
local dir="$1"
if [[ ! -d "$dir" ]]; then
echo "Error: '$dir' is not a valid directory" >&2
return 1
fi
dir=$(cd "$dir" && pwd) || return 1