Skip to content

Instantly share code, notes, and snippets.

View NucciTheBoss's full-sized avatar
👾
All your source belong to us

Jason Nucciarone NucciTheBoss

👾
All your source belong to us
View GitHub Profile
@NucciTheBoss
NucciTheBoss / licenseinfogplv3.py
Created July 20, 2021 19:30
Print licensing info for program licensed under GPLv3
def licenseinfo(desc: str, year: str, *args) -> None:
"""
Print out program license info in GNU GPLv3 format to standard output.
### Parameters:
:param desc: Name and short description of program.
:param year: Year of copyright.
- args
- author(s): Names of authors that hold copyright on program.
"""
@NucciTheBoss
NucciTheBoss / versioninfogplv3.py
Created July 20, 2021 19:31
Print version info for program licensed under GPLv3 with optional ASCII banner
import os
def versioninfo(name: str, year: str, show_w: str, show_c: str, *args, **kwargs) -> None:
"""
Print out program version info in GNU GPLv3 format to standard output.
### Parameters:
:param name: Name of program.
:param year: Year of copyright.
@NucciTheBoss
NucciTheBoss / Pythonmoduleinstall.sh
Last active July 31, 2021 23:39
Locally install Python for use with Tmod or Lmod on Linux HPC systems
#!/usr/bin/env bash
# Use this file if compiling with gcc version 8.3.1 or greater
VERSION=3.9.5 INSTALL_DIR=$HOME/sw && \
wget https://www.python.org/ftp/python/$VERSION/Python-$VERSION.tgz -O - | tar -xzv && \
cd Python-$VERSION && \
./configure --enable-shared --enable-optimizations --prefix=$INSTALL_DIR/python-$VERSION && \
make && make install && \
cd .. && rm -rf Python-$VERSION Python-$VERSION.tgz && \
cd $INSTALL_DIR/python-$VERSION/bin && \
@NucciTheBoss
NucciTheBoss / compress.py
Created September 25, 2021 23:18
Compress an entire directory tree in various compression formats
import tarfile
from zipfile import ZipFile
from tqdm import tqdm
from ..filesystem import getpaths as gp
class Compression:
def __init__(self, directory: str, name: str) -> None:
@NucciTheBoss
NucciTheBoss / getpaths.py
Created September 25, 2021 23:26
Query file system to grab all files or a specific file
import os
from typing import List, Union
def getdirs(*paths) -> List:
"""
Get subdirectory structure of passed paths
### Parameters:
- args
@NucciTheBoss
NucciTheBoss / revert-apt-autoremove.sh
Last active February 28, 2022 16:12
Revert autoremove on apt-based Linux distributions
#!/usr/bin/env bash
sudo apt-get install $(grep Remove /var/log/apt/history.log | tail -1 | sed -e 's|Remove: ||g' -e 's|([^)]*)||g' -e 's|:[^ ]* ||g' -e 's|,||g')
@NucciTheBoss
NucciTheBoss / install-apptainer-ubuntu.sh
Last active February 4, 2022 19:51
Script to install Apptainer (Singularity) on Ubuntu/Debian-based machines
#!/usr/bin/env bash
#########################################
#
# Install Apptainer dependencies
#
#########################################
sudo apt-get update && sudo apt-get install -y \
build-essential \
@NucciTheBoss
NucciTheBoss / move-conda-envs.sh
Created March 21, 2022 17:44
Move conda environments to a new location on your Linux system.
#!/usr/bin/env bash
echo "Begin environment relocation."
NEW_ENV_DIR=$1
BASE_ENV=$(conda info --base)
#########################################
#
# Install jq locally
#
@NucciTheBoss
NucciTheBoss / ubuntu-configure-work.sh
Last active June 15, 2022 03:04
Bootstrap my Ubuntu machines for work using Bash
#!/usr/bin/env bash
TARGET_USER=$1
HOME_DIR=$2
mkdir -p /opt/sw && cd /opt/sw
#########################################
#
# Author: Jason C. Nucciarone
# Last Revision: 6/14/22 @ 23:04 EST
@NucciTheBoss
NucciTheBoss / create-nova-instance.sh
Created July 5, 2022 14:58
Create a Nova VM on a deployed OpenStack cluster
# Set up local environment for working with the OpenStack cluster
source ~/.novarc
# Install OpenStack CLI
sudo snap install openstackclients
# Create ssh key for access to Nova VMs
ssh-keygen -t rsa -b 4096 -q -N '' -f ~/cloud-keys/id_overcloud
openstack keypair create --public-key ~/cloud-keys/id_overcloud.pub overcloudkey