Last active
February 2, 2024 11:57
-
-
Save ulfaslak/250947819d6944d771184e2c60071abc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
newpy () { | |
local lowercase_string="$(echo "$1" | tr '[:upper:]' '[:lower:]')" # Convert folder name to lowercase | |
local hyphenated_string="$(echo "$lowercase_string" | tr -c '[:alnum:]' '-')" # Convert non-alphanumeric characters to hyphens | |
local clean_string="$(echo "$hyphenated_string" | sed -e 's/^-*//' -e 's/-*$//')" # Remove leading and trailing hyphens | |
folder_name=$(date +%Y%m%d)-$clean_string # Prepend date, formatted like YYYYMMDD | |
mkdir -p <repository-where-i-want-my-adhoc-analysis-folders-to-reside>/$folder_name # Create folder | |
cd <repository-where-i-want-my-adhoc-analysis-folders-to-reside>/$folder_name # ... cd into it | |
virtualenv env # Create virtual env | |
source env/bin/activate # ... activate it | |
pip3 install -U flake8 black # Install packages you always use | |
code . # Launch VSCode | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment