Skip to content

Instantly share code, notes, and snippets.

@jonathanagustin
jonathanagustin / bootstrap.py
Last active June 30, 2024 11:26
Bootstrap Google Colab
%matplotlib inline
def bootstrap():
# @title Bootstrap Google Colab {display-mode:"form"}
# CONFIGURE: Parameters
GOOGLE_DRIVE_FOLDER = "my_folder" # @param {type:"string"}
GitHub = True # @param {type:"boolean"}
OpenAI = True # @param {type:"boolean"}
HuggingFace = True # @param {type:"boolean"}
@jonathanagustin
jonathanagustin / Kubernetes Resource Extractor.md
Last active June 6, 2024 05:56
Kubernetes Resource Extractor

Resource Extractor

This Go application parses the output of a helm template or kubectl kustomize command and extracts resource information, generating a CSV file with the extracted data.

Prerequisites

  • Go (version 1.17 or later)
  • Helm (version 3 or later) (if using Helm)
  • kubectl (if using Kustomize)
@jonathanagustin
jonathanagustin / install-autogluon-colab.py
Last active May 31, 2024 02:47
Install autogluon on Google Colab
%%capture
# ---------------------------------------------------------------------------- #
# @title Install autogluon on Google Colab { display-mode: "form" }
# ---------------------------------------------------------------------------- #
import contextlib
with open('/content/install-autogluon.log', 'w') as f:
with contextlib.redirect_stdout(f):
%pip install uv
!git clone --recurse-submodules --depth=1 https://github.com/autogluon/autogluon.git
!uv pip install --system -e /content/autogluon/common/
@jonathanagustin
jonathanagustin / install-auto-sklearn-colab.py
Last active May 31, 2024 02:46
Install auto-sklearn on Google Colab
%%capture
# ---------------------------------------------------------------------------- #
# @title Install auto-sklearn on Google Colab { display-mode: "form" }
# ---------------------------------------------------------------------------- #
import contextlib
with open('/content/install-auto-sklearn.log', 'w') as f:
with contextlib.redirect_stdout(f):
%pip install uv
!uv pip install --system Cython==0.29.36 pyparsing==2.4
!uv pip install --system -r https://raw.githubusercontent.com/automl/auto-sklearn/master/requirements.txt
@jonathanagustin
jonathanagustin / git-lfs-track.py
Created May 26, 2024 15:40
Git LFS Track Files Over a Threshold (Default is 100MB)
#!/usr/bin/env python3
import subprocess
from pathlib import Path
SKIP_LIST = [
".git",
"build",
"venv",
".venv",
"node_modules",
print("Hello, World!")
@jonathanagustin
jonathanagustin / colab2pdf.py
Created November 7, 2023 22:51
Convert your Colab notebook to a PDF. One-minute install. Zero configuration.
# Colab2PDF v1.0.0 by Drengskapur (github.com/drengskapur/colab2pdf) (License: GPL-3.0-or-later)
# @title {display-mode:"form"}
# @markdown ⬇️ Download PDF
def colab2pdf():
ENABLE=True # @param {type:"boolean"}
if ENABLE:
import os, datetime, json, pathlib, urllib, requests, werkzeug, nbformat, google, yaml, warnings
NAME = pathlib.Path(werkzeug.utils.secure_filename(urllib.parse.unquote(requests.get(f"http://{os.environ['COLAB_JUPYTER_IP']}:{os.environ['KMP_TARGET_PORT']}/api/sessions").json()[0]["name"])))
TEMP = pathlib.Path("/content/pdfs") / f"{datetime.datetime.now().strftime('%Y%m%d_%H%M%S')}_{NAME.stem}"; TEMP.mkdir(parents=True, exist_ok=True)
NB = [cell for cell in nbformat.reads(json.dumps(google.colab._message.blocking_request("get_ipynb", timeout_sec=30)["ipynb"]), as_version=4).cells if "--Colab2PDF" not in cell.source]
@jonathanagustin
jonathanagustin / colab2pdf.py
Last active April 2, 2024 06:29
Convert Google Colab Notebook to PDF
# @title Convert Notebook to PDF. Save Notebook to: `/content/drive/MyDrive/Colab Notebooks'
NOTEBOOK_NAME = "notebooke.ipynb" # @param {type:"string"}
#------------------------------------------------------------------------------#
from google.colab import drive
drive.mount("/content/drive/", force_remount=True)
NOTEBOOKS = "/content/drive/MyDrive/Colab Notebooks"
NOTEBOOK_PATH = f"{NOTEBOOKS}/{NOTEBOOK_NAME}"
assert os.path.exists(NOTEBOOK_PATH), f"NOTEBOOK NOT FOUND: {NOTEBOOK_PATH}"
!apt install -y texlive-xetex texlive-fonts-recommended texlive-plain-generic
!jupyter nbconvert "$NOTEBOOK_PATH" --to pdf
@jonathanagustin
jonathanagustin / crumbcutter.json
Created September 21, 2023 08:14
crumbcutter-index
{
"project_name": "Index",
"author": "Anonymous"
}
@jonathanagustin
jonathanagustin / _readme.md
Created June 8, 2022 06:19 — forked from maxivak/_readme.md
Vagrant with Ubuntu 16.04 in VirtualBox

Setup Ubuntu 16.04 to be used with Vagrant and Virtualbox

Prepare Vagrant box with Ubuntu 16.04

We will use official box "ubuntu/xenial64" and modify it to work with Vagrant.

  • Vagrantfile