Skip to content

Instantly share code, notes, and snippets.

View Johnpc123's full-sized avatar

John P. Costello M.Sc. Johnpc123

View GitHub Profile
@Johnpc123
Johnpc123 / alias_python.sh
Created July 17, 2025 14:34
Tired of hunting for your Python scripts and wrestling with virtual environments? This tool is your new best friend! It lets you run any Python utility with a simple command-line alias. Just point it to your script, and it automatically handles the boring stuff: creating a fresh virtual environment, upgrading pip to the latest version, and insta…
#!/bin/bash
# alias_python.sh
#
# Purpose:
# This script is designed to save effort when setting up and running Python utilities. It centralizes the process by allowing you to create simple aliases in your .bashrc, so you don't have to remember where each script is located. It also automates the creation of a Python virtual environment, upgrades pip, and installs any requirements listed in a requirements.txt file alongside your script. This makes it easy to keep your Python utilities isolated, up-to-date, and easy to run from anywhere.
#
# Usage: create an alias for this script, add the following line to your ~/.bashrc:
# alias runmyscript='~/scripts/alias_python.sh <venv_path> <script_path>'
# Replace <venv_path> and <script_path> as needed, or call the script directly with your parameters.
@Johnpc123
Johnpc123 / open-with-wsl.sh
Created June 27, 2025 09:51
WSL aware VSCode (flavor) launcher
#!/bin/bash
#
# ==============================================================================
# WSL aware VSCode (flavor) launcher
# ==============================================================================
#
# This resolves a very disruptive workflow issue where, even when using a WSL terminal directly, VScode projects open in a windows
# environment by default. Making it necessary to use the --remote flag, and to
# specify the remote, or to click through the menus to reopen the project in WSL.
#
@Johnpc123
Johnpc123 / purge-git-path-history.sh
Last active June 26, 2025 14:59
Purges all git history of a folder, but keeps its current state in the latest commit. Used for clearing accidentaly commiting unencrypted secrets.
#!/bin/bash
# purge-git-path-history.sh
# Purges all git history of a file or folder, but keeps its current state in the latest commit.
# Useful for when you've accidentally commited sensitive or confidential information and must purge it from commmit history
# with post-operation guidance, safety checks, and logging.
set -e
usage() {
vagrant : INFO global: Vagrant version: 2.2.9
At line:1 char:1
+ vagrant up --debug 2>&1 | Tee-Object -FilePath ".\vagrant_clean.log"
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( INFO global: Vagrant version: 2.2.9:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
INFO global: Ruby version: 2.6.6
INFO global: RubyGems version: 3.0.3
@Johnpc123
Johnpc123 / life.html
Last active October 3, 2024 12:31
🔥
<!-- https://practicalcoder.com/life.html -->
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<style>
.finger-onDiv {cursor: pointer; cursor: hand;}
#msgg {font-size: 18pt}
</style>