Skip to content

Instantly share code, notes, and snippets.

View TheProjectsGuy's full-sized avatar
🎯
Focusing

Avneesh Mishra TheProjectsGuy

🎯
Focusing
View GitHub Profile
@TheProjectsGuy
TheProjectsGuy / python_path_gimmick.py
Created April 19, 2022 04:49
A gimmick to add a path to python interpreter
import os
import sys
from pathlib import Path
# Set the "./../lib" from the script folder
dir_name = None
try:
dir_name = os.path.dirname(os.path.realpath(__file__))
except NameError:
print("WARN: __file__ not found, trying local")
dir_name = os.path.abspath('')
@TheProjectsGuy
TheProjectsGuy / csinteractive.sh
Last active October 23, 2023 08:15
A helpful SLURM utility. Get node allocation using salloc and run an interactive shell session on it. This, plus many more bells and whistles.
#!/bin/bash
# Copyright (C) 2022 Avneesh Mishra - GNU GPLv3
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
@TheProjectsGuy
TheProjectsGuy / proc_see_kill.sh
Last active April 22, 2023 07:41
Monitor the RAM utilization of a process and kill it if it is above a threshold. Can be put in a cron job. The kills are logged. If manually invoked (on Linux Mint), a system notification is also sent.
#!/bin/bash
readonly VERSION_MAJOR=1
readonly VERSION_MINOR=2
VERSION="${VERSION_MAJOR}.${VERSION_MINOR}"
# Program properties
readonly ARGS="$@" # Reset using https://stackoverflow.com/a/4827707
readonly PROGNAME=$(basename $0)
readonly PROGPATH=$(realpath $(dirname $0))