Add documentation for all scripts: bootstrap_setup, buildnote, most_recent_note, notetaker, kaggle_manager, promodoro, promodoro_menu, setup_crontab, add_ipykernel, get_app_id, setup_macos_dock

This commit is contained in:
Jeremie Fraeys 2026-02-09 14:01:26 -05:00
parent b22ea85e9e
commit 74719361ee
No known key found for this signature in database
11 changed files with 545 additions and 0 deletions

View file

@ -0,0 +1,59 @@
## [add_ipykernel](../../scripts/add_ipykernel)
Adds Python virtual environments as Jupyter ipykernel options.
## Description
This script automates the creation and registration of Python environments as Jupyter kernels. It supports both conda and pip virtual environments.
## Usage
```bash
./add_ipykernel.sh ENV_NAME [--create] [--verbose] [pkg1 pkg2 ...]
```
## Arguments
- `ENV_NAME`: Name of the environment/kernel to create or use
- `--create`: Create a new environment if it doesn't exist
- `--verbose`: Enable detailed output
- `pkg1 pkg2 ...`: Additional packages to install
## Examples
```bash
# Create new conda environment and register as kernel
./add_ipykernel.sh ds_env --create python=3.11 pandas
# Use existing environment
./add_ipykernel.sh ds_env --verbose
# Create pip venv with specific packages
./add_ipykernel.sh myproject --create numpy scipy matplotlib
```
## Package Manager Detection
The script automatically detects the appropriate package manager:
- **conda**: Used if environment exists in conda or if `environment.yml`/`conda.yaml` is present
- **pip**: Used if `requirements.txt` or `pyproject.toml` exists, or if already in a virtual environment
## What It Does
1. Detects package manager (conda or pip)
2. Creates environment if `--create` flag is used
3. Activates the environment
4. Installs `ipykernel` if not present
5. Registers the environment as a Jupyter kernel with display name `Python (ENV_NAME)`
## Requirements
- conda (for conda environments) OR python3 with venv (for pip environments)
- Jupyter installed (for kernel registration)
## Notes
- Kernels are registered in user space (`--user` flag)
- After registration, the kernel appears in Jupyter as "Python (ENV_NAME)"
- If environment already exists, just registers it without modifying packages

View file

@ -0,0 +1,54 @@
## [bootstrap_setup](../../scripts/bootstrap_setup)
Bootstraps a new development machine by installing essential tools and setting up the development environment.
## Description
This script automates the initial setup of a new development machine by:
- Installing essential tools (git, stow, curl)
- Installing package manager (Homebrew on macOS)
- Cloning the dotfiles repository
- Setting up development scripts
**Platform Support:** macOS (Homebrew), Linux (apt)
## Usage
```bash
./bootstrap_setup.sh [--dry-run]
```
## Options
- `--dry-run`: Enable dry run mode. Commands will be echoed but not executed.
## What It Does
1. **Installs essential tools:**
- Linux: `apt update && apt install -y git stow curl`
- macOS: Installs Xcode Command Line Tools, Homebrew, then `brew install stow git curl`
2. **Clones dotfiles repository:**
- Clones `https://github.com/jfrays/dotfiles.git` to `~/.dotfiles`
- Runs the dotfiles setup script
3. **Sets up development scripts:**
- Creates `~/.local/bin/scripts` directory
- Clones scripts repository to the scripts directory
- Runs `setup_dev_env.sh` to complete the environment setup
## Example
```bash
# Run the bootstrap normally
./bootstrap_setup.sh
# Preview what would happen without making changes
./bootstrap_setup.sh --dry-run
```
## Notes
- The script uses `set -e` to exit immediately if any command fails
- Ensure you have sudo access on Linux systems
- On macOS, you may need to approve Xcode license after command line tools installation

55
docs/buildnote/Usage.md Normal file
View file

@ -0,0 +1,55 @@
## [buildnote](../../scripts/buildnote)
Converts markdown notes to PDF using pandoc with xelatex engine.
## Description
This script generates professionally formatted PDF documents from markdown files. It uses pandoc with the xelatex PDF engine and applies syntax highlighting, custom fonts, and margins.
## Dependencies
- pandoc
- xelatex (TeX Live)
- DejaVu fonts (DejaVuSerif, DejaVuSans, DejaVuSansMono)
## Usage
```bash
./buildnote.sh <input_file> <output_file>
```
## Arguments
- `input_file`: Path to the markdown file to convert
- `output_file`: Path for the generated PDF file
## Features
- **PDF Engine**: xelatex for Unicode and custom font support
- **Syntax Highlighting**: pygments style for code blocks
- **Fonts**:
- Main: DejaVuSerif (with Bold, Italic, BoldItalic variants)
- Sans: DejaVuSans
- Mono: DejaVuSansMono
- **Margins**: 1 inch on all sides
- **Links**: NavyBlue color for URLs
## Example
```bash
# Convert a markdown note to PDF
./buildnote.sh notes.md output.pdf
# The script runs in background and prints the output path
./buildnote.sh ~/notes/daily.md ~/notes/daily.pdf
```
## Integration with Neovim
The script is designed to work with Neovim. It prints the output file path on the last line, which can be captured by editor integrations.
## Notes
- The conversion runs in the background (using `&`)
- Ensure all dependencies are installed before running
- The script validates that the input file exists before processing

62
docs/get_app_id/Usage.md Normal file
View file

@ -0,0 +1,62 @@
## [get_app_id](../../scripts/get_app_id)
Retrieves macOS application bundle identifiers.
## Description
This script extracts the code-signing identifier (bundle ID) from macOS application bundles. Useful for automation, scripting, and identifying applications programmatically.
## Platform
**macOS only** - Uses `codesign` command which is macOS-specific
## Usage
```bash
./get_app_id.sh [app_name|app_path]
```
## Arguments
- `app_name`: Name of the app (e.g., "Safari" or "Safari.app")
- `app_path`: Full path to the .app bundle (e.g., "/Applications/Safari.app")
## Examples
```bash
# Interactive mode - select from all applications using fzf
./get_app_id.sh
# Get bundle ID by app name
./get_app_id.sh Safari
# Get bundle ID by full path
./get_app_id.sh /Applications/Safari.app
# Output: com.apple.Safari
```
## Interactive Mode
When run without arguments, the script:
1. Lists all applications in `/Applications`
2. Opens an fzf picker with live preview showing the bundle ID
3. Returns the selected app's identifier
## Requirements
- macOS with `codesign` command (included in Xcode Command Line Tools)
- fzf (for interactive mode): `brew install fzf`
## How It Works
The script extracts the identifier from the code signature using:
```bash
codesign -dr - "/Applications/AppName.app" | grep identifier
```
## Notes
- Apps must be code-signed to have a bundle identifier
- Some apps may not have code signatures (returns error)
- The interactive preview shows "No code signature found" for unsigned apps

View file

@ -0,0 +1,63 @@
## [kaggle_manager](../../scripts/kaggle_manager)
Manages Kaggle datasets and notebooks via the Kaggle API.
## Description
This script provides command-line access to Kaggle functionality including:
- Downloading datasets
- Fetching notebooks
- Submitting competition entries
## Prerequisites
You must have a `kaggle.json` file at `~/.kaggle/kaggle.json` containing your Kaggle credentials:
```json
{
"username": "your_username",
"key": "your_api_key"
}
```
## Usage
```bash
./kaggle_manager.sh [options]
```
## Options
- `-d, --dataset <name>`: Download a dataset (format: `username/dataset-name`)
- `-n, --notebook <name>`: Download a notebook (format: `username/notebook-name`)
- `-s, --submit <file>`: Submit a notebook file to a competition
- `-c, --competition <name>`: Specify competition name for submission
- `-g, --git`: Add and commit changes to Git after operation
- `-v, --verbose`: Enable verbose output
- `-h, --help`: Display help message
## Examples
```bash
# Download a dataset
./kaggle_manager.sh -d "zillow/zecon"
# Download a notebook
./kaggle_manager.sh -n "jfraeys/my-notebook"
# Submit to competition
./kaggle_manager.sh -s submission.csv -c "titanic"
# Download with Git commit
./kaggle_manager.sh -d "zillow/zecon" -g
```
## Directory Structure
- Datasets: Stored in `data/raw/`
- Notebooks: Stored in `notebooks/`
## Notes
- The script uses curl to interact with the Kaggle API
- Credentials are extracted from kaggle.json using jq
- Git commits use the message: "Added dataset or notebook"

View file

@ -0,0 +1,29 @@
## [most_recent_note](../../scripts/most_recent_note)
Opens the most recently created PDF note from the Google Drive notes folder.
## Description
This script finds the most recently modified PDF file in `~/Google Drive/My Drive/notes/pdf` and opens it with zathura PDF viewer.
## Dependencies
- zathura (PDF viewer)
## Usage
```bash
./most_recent_note.sh
```
## How It Works
1. Searches for all PDF files in `~/Google Drive/My Drive/notes/pdf`
2. Sorts them by modification time (newest first)
3. Opens the most recent PDF with zathura
## Notes
- Requires Google Drive to be synced to the local machine
- Assumes notes are stored in the specific path: `~/Google Drive/My Drive/notes/pdf`
- zathura must be installed and available in PATH

44
docs/notetaker/Usage.md Normal file
View file

@ -0,0 +1,44 @@
## [notetaker](../../scripts/notetaker)
Creates and opens daily markdown notes with YAML frontmatter in Neovim.
## Description
This script automates the creation of daily notes by:
- Creating a markdown file for the current date if it doesn't exist
- Adding YAML frontmatter with title, author, and date
- Opening the file in Neovim with automatic timestamp insertion
## Usage
```bash
./notetaker.sh
```
## File Location
Notes are stored in: `~/Google Drive/My Drive/notes/src/note-YYYY-MM-DD.md`
## YAML Frontmatter
New notes are created with the following frontmatter:
```yaml
---
title: "Notes"
author: "Jeremie Fraeys"
date: YYYY-MM-DD
---
```
## Neovim Integration
When opening the note, Neovim is configured to:
- Jump to the end of the file
- Insert a timestamped subtitle (e.g., `## 14:30`)
- Enter insert mode ready for typing
## Notes
- Google Drive sync is required for notes to be backed up
- The script creates the note file if it doesn't exist, or opens the existing one
- Requires Neovim to be installed and available in PATH

29
docs/promodoro/Usage.md Normal file
View file

@ -0,0 +1,29 @@
## [promodoro](../../scripts/promodoro)
Pomodoro timer script for productivity tracking.
## Description
A simple Pomodoro timer implementation that helps track work sessions using the Pomodoro Technique - alternating focused work periods with short breaks.
## Usage
```bash
./promodoro.sh [options]
```
## Features
- Customizable work and break durations
- Visual/audible notifications when sessions end
- Tracks completed pomodoros
- Session logging
## Integration
Use with `promodoro_menu.sh` for an interactive menu interface.
## Notes
- Designed to run in terminal or tmux status bar
- Can be customized for different work/break ratios

View file

@ -0,0 +1,29 @@
## [promodoro_menu](../../scripts/promodoro_menu)
Interactive menu interface for the Pomodoro timer.
## Description
Provides a user-friendly menu interface for controlling the Pomodoro timer, allowing easy start, stop, and configuration of work sessions.
## Usage
```bash
./promodoro_menu.sh
```
## Features
- Interactive menu for Pomodoro timer control
- Options to start/stop/reset timer
- Configuration of work and break durations
- Status display
## Integration
Works with `promodoro.sh` for the actual timing functionality.
## Notes
- Provides a more user-friendly interface than the command-line timer
- Can be run in terminal or integrated with dmenu/rofi for desktop environments

View file

@ -0,0 +1,63 @@
## [setup_crontab](../../scripts/setup_crontab)
Sets up automated cron jobs from a configuration file.
## Description
This script manages cron jobs by reading from `mycronjobs.txt` and merging them into the system crontab. It intelligently avoids duplicate entries and ensures the cron service is running.
## Usage
```bash
./setup_crontab.sh
```
## Configuration File
The script expects a cron job definition file at:
`~/.local/bin/mycronjobs.txt`
Example `mycronjobs.txt`:
```
# Daily backup at 2 AM
0 2 * * * /home/user/.local/bin/backup.sh
# Weekly cleanup on Sundays
0 0 * * 0 /home/user/.local/bin/cleanup.sh
```
## Features
- **Smart Merging**: Only adds new jobs, skips existing duplicates
- **Comments Support**: Lines starting with `#` are ignored
- **Service Management**: Automatically starts cron service on Linux
- **Cross-Platform**: Works on Linux (systemd) and macOS (launchd)
## Platform Behavior
### Linux
- Starts cron via `systemctl` if not running
- Uses standard crontab
### macOS
- Uses launchd (cron runs automatically)
- No additional service management needed
## Example Output
```
✅ Added 2 new cron job(s):
+ 0 2 * * * /home/user/.local/bin/backup.sh
+ 0 0 * * 0 /home/user/.local/bin/cleanup.sh
```
Or if jobs already exist:
```
No new cron jobs to add; all jobs already present.
```
## Notes
- The script uses `set -euo pipefail` for strict error handling
- Existing crontab entries are preserved
- Empty lines are ignored during processing

View file

@ -0,0 +1,58 @@
## [setup_macos_dock](../../scripts/setup_macos_dock)
Configures macOS Dock settings and populates it with preferred applications.
## Platform
**macOS only** - Uses `defaults` and `dockutil`
## Description
This script automates the configuration of the macOS Dock by:
- Setting visual preferences (auto-hide, size, magnification)
- Removing all existing Dock items
- Adding a curated list of frequently used applications
- Restarting the Dock to apply changes
## Usage
```bash
./setup_macos_dock.sh
```
## Dock Settings Applied
| Setting | Value | Description |
|---------|-------|-------------|
| autohide | true | Dock hides automatically |
| tilesize | 50 | Icon size (pixels) |
| largesize | 64 | Magnified icon size |
| magnification | false | Disable icon magnification |
| orientation | bottom | Dock position |
| mineffect | "" | Minimize effect (none) |
| NSAutomaticWindowAnimationsEnabled | false | Disable window animations |
## Default Applications
The script adds these apps to the Dock (in order):
1. Mail.app
2. Messages.app
3. WezTerm.app
4. Obsidian.app
5. Zen.app
6. System Settings.app
## Requirements
- macOS
- dockutil: `brew install dockutil` (script auto-installs if missing)
## Warning
**This script removes ALL existing Dock items** before adding the preferred applications. Your current Dock configuration will be replaced.
## Notes
- The Dock automatically restarts after configuration
- System Settings may be called "System Preferences" on older macOS versions
- Edit the script to customize the list of applications