Skip to content

Instantly share code, notes, and snippets.

View ulfaslak's full-sized avatar
🐝
modeling modeling

Ulf Aslak ulfaslak

🐝
modeling modeling
View GitHub Profile
@ulfaslak
ulfaslak / main.py
Created January 10, 2024 14:37
Sphinx Documentation Scraper
import requests as rq
import os
from bs4 import BeautifulSoup
from urllib.parse import urljoin
BASE_URL = "https://www.pymc.io/projects/docs/en/stable/"
# BASE_URL = "https://www.pymc.io/projects/examples/en/latest/"
PAGES_CRAWLED = 0
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