diff --git a/backups/complete/RESTORE_INSTRUCTIONS.md b/backups/complete/RESTORE_INSTRUCTIONS.md new file mode 100644 index 0000000..8aa48b2 --- /dev/null +++ b/backups/complete/RESTORE_INSTRUCTIONS.md @@ -0,0 +1,64 @@ +# Complete Secrets Restore Instructions + +## Master Encrypted Backup + +This is your complete backup of all private keys, certificates, and sensitive configurations. + +### What's Included +- SSH keys and configuration +- GPG private keys and keyring +- Docker authentication +- Application licenses +- Any other sensitive configuration files + +### Restore Process + +#### Step 1: Decrypt the backup +```bash +gpg --decrypt all_secrets_TIMESTAMP.tar.gz.gpg > all_secrets_TIMESTAMP.tar.gz +``` + +#### Step 2: Extract to temporary location first +```bash +mkdir ~/restore_temp +tar -xzf all_secrets_TIMESTAMP.tar.gz -C ~/restore_temp +``` + +#### Step 3: Review and restore selectively +```bash +# SSH (if needed) +cp -r ~/restore_temp/secrets/.ssh ~/ +chmod 700 ~/.ssh +chmod 600 ~/.ssh/config ~/.ssh/*_rsa ~/.ssh/id_* +chmod 644 ~/.ssh/*.pub + +# GPG (if needed) +cp -r ~/restore_temp/secrets/.gnupg ~/ +chmod 700 ~/.gnupg +chmod 600 ~/.gnupg/* +chmod 700 ~/.gnupg/private-keys-v1.d +chmod 600 ~/.gnupg/private-keys-v1.d/* +gpgconf --kill gpg-agent # Restart GPG agent + +# Docker (if needed) +mkdir -p ~/.docker +cp ~/restore_temp/secrets/.docker/config.json ~/.docker/ + +# Other files as needed +``` + +#### Step 4: Cleanup +```bash +rm -rf ~/restore_temp +rm all_secrets_TIMESTAMP.tar.gz +``` + +## Security Notes + +- This backup contains ALL your private keys and secrets +- Keep it in multiple secure locations +- Test restore process periodically +- Never store unencrypted - always use GPG encryption + +Created: $(date) +System: $(sw_vers -productVersion) diff --git a/backups/complete/all_secrets_20250728_221939.tar.gz.gpg b/backups/complete/all_secrets_20250728_221939.tar.gz.gpg new file mode 100644 index 0000000..d3f47cf Binary files /dev/null and b/backups/complete/all_secrets_20250728_221939.tar.gz.gpg differ diff --git a/backups/docker/RESTORE_INSTRUCTIONS.md b/backups/docker/RESTORE_INSTRUCTIONS.md new file mode 100644 index 0000000..e69de29 diff --git a/backups/docker/docker_20250728_211658.tar.gz.gpg b/backups/docker/docker_20250728_211658.tar.gz.gpg new file mode 100644 index 0000000..48ca31f Binary files /dev/null and b/backups/docker/docker_20250728_211658.tar.gz.gpg differ diff --git a/backups/gpg/RESTORE_INSTRUCTIONS.md b/backups/gpg/RESTORE_INSTRUCTIONS.md new file mode 100644 index 0000000..d713fe4 --- /dev/null +++ b/backups/gpg/RESTORE_INSTRUCTIONS.md @@ -0,0 +1,45 @@ +# GPG Keyring Restore Instructions + +## Decrypting and Restoring GPG Keys + +To restore from backup: `gpg_keyring_TIMESTAMP.tar.gz.gpg` + +### Step 1: Decrypt the backup +```bash +gpg --decrypt gpg_keyring_TIMESTAMP.tar.gz.gpg > gpg_keyring_TIMESTAMP.tar.gz +``` + +### Step 2: Extract to home directory +```bash +tar -xzf gpg_keyring_TIMESTAMP.tar.gz -C ~/ +``` + +### Step 3: Set correct permissions +```bash +chmod 700 ~/.gnupg +chmod 600 ~/.gnupg/* +chmod 700 ~/.gnupg/private-keys-v1.d +chmod 600 ~/.gnupg/private-keys-v1.d/* +``` + +### Step 4: Restart GPG agent +```bash +gpgconf --kill gpg-agent +gpg --list-secret-keys # This will restart the agent +``` + +## Security Notes + +- Contains your GPG private keys - highly sensitive +- Keep encrypted backup in secure location +- Test restore process periodically + +## What's Included + +- Private keys (private-keys-v1.d/) +- Public keyring (pubring.kbx) +- Trust database (trustdb.gpg) +- GPG configuration files + +Created: $(date) +System: $(sw_vers -productVersion) diff --git a/backups/gpg/gpg_keyring_20250728_211658.tar.gz.gpg b/backups/gpg/gpg_keyring_20250728_211658.tar.gz.gpg new file mode 100644 index 0000000..f54fe45 Binary files /dev/null and b/backups/gpg/gpg_keyring_20250728_211658.tar.gz.gpg differ diff --git a/backups/ssh/RESTORE_INSTRUCTIONS.md b/backups/ssh/RESTORE_INSTRUCTIONS.md new file mode 100644 index 0000000..2d59c23 --- /dev/null +++ b/backups/ssh/RESTORE_INSTRUCTIONS.md @@ -0,0 +1,46 @@ +# SSH Keys Restore Instructions + +## Decrypting and Restoring SSH Keys + +To restore from backup: `ssh_keys_20250727_132554.tar.gz.gpg` + +### Step 1: Decrypt the backup +```bash +gpg --decrypt ssh_keys_20250727_132554.tar.gz.gpg > ssh_keys_20250727_132554.tar.gz +``` + +### Step 2: Extract the archive +```bash +tar -xzf ssh_keys_20250727_132554.tar.gz -C ~/ +``` + +### Step 3: Set correct permissions +```bash +chmod 700 ~/.ssh +chmod 600 ~/.ssh/config +chmod 600 ~/.ssh/*_key ~/.ssh/id_* +chmod 644 ~/.ssh/*.pub +``` + +### Step 4: Add keys to SSH agent (if needed) +```bash +ssh-add ~/.ssh/your_key_name +``` + +## Security Notes + +- Keep this encrypted backup in a secure location +- The backup contains your private keys - treat it as highly sensitive +- Consider storing a copy in a different location (cloud storage, external drive) +- Test the restore process periodically + +## Backup Contents + +This backup includes: +- SSH configuration file +- Private keys found in ~/.ssh/ +- Corresponding public keys +- Proper directory structure + +Created: Sun Jul 27 13:26:00 CEST 2025 +System: 15.5 diff --git a/backups/ssh/ssh_keys_20250727_132554.tar.gz.gpg b/backups/ssh/ssh_keys_20250727_132554.tar.gz.gpg new file mode 100644 index 0000000..089649a Binary files /dev/null and b/backups/ssh/ssh_keys_20250727_132554.tar.gz.gpg differ diff --git a/bin/new-license b/bin/new-license new file mode 100755 index 0000000..9cc4504 --- /dev/null +++ b/bin/new-license @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Quick license entry helper for pass +# Following prime directive: streamlined license management + +if [[ $# -ne 1 ]]; then + echo "Usage: new-license " + echo "Example: new-license BBEdit" + exit 1 +fi + +APP_NAME="$1" +TEMPLATE="$HOME/dotfiles/pass-templates/license-template.txt" + +# Check if template exists +if [[ ! -f "$TEMPLATE" ]]; then + echo "❌ Template not found: $TEMPLATE" + exit 1 +fi + +# Create temp file with template +TEMP_FILE=$(mktemp) +cp "$TEMPLATE" "$TEMP_FILE" + +# Open in editor +${EDITOR:-vim} "$TEMP_FILE" + +# Add to pass +pass insert --multiline "licenses/$APP_NAME" < "$TEMP_FILE" + +# Cleanup +rm "$TEMP_FILE" + +echo "βœ… License for $APP_NAME added to pass" +echo "πŸ“‹ View with: pass licenses/$APP_NAME" +echo "✏️ Edit with: pass edit licenses/$APP_NAME" \ No newline at end of file diff --git a/config/git/ignore b/config/git/ignore new file mode 100644 index 0000000..66d62f8 --- /dev/null +++ b/config/git/ignore @@ -0,0 +1 @@ +**/.claude/settings.local.json diff --git a/config/iterm2/AppSupport/EnableAI.secureSetting b/config/iterm2/AppSupport/EnableAI.secureSetting new file mode 100644 index 0000000..cf724b5 --- /dev/null +++ b/config/iterm2/AppSupport/EnableAI.secureSetting @@ -0,0 +1,2 @@ +2f55736572732f6461766964676c696464656e2f4c6962726172792f4170706c69636174696f6e20537570706f72742f695465726d322f456e61626c6541492e73656375726553657474696e67 0975c0e7440a897bbddeb6c6945a2eb9bcdecaaa4840bebc3955dd9a3df359bb +74727565 \ No newline at end of file diff --git a/config/iterm2/AppSupport/SavedState/lock b/config/iterm2/AppSupport/SavedState/lock new file mode 100644 index 0000000..e69de29 diff --git a/config/iterm2/AppSupport/SavedState/restorable-state.sqlite b/config/iterm2/AppSupport/SavedState/restorable-state.sqlite new file mode 100644 index 0000000..27631cf Binary files /dev/null and b/config/iterm2/AppSupport/SavedState/restorable-state.sqlite differ diff --git a/config/iterm2/AppSupport/SavedState/restorable-state.sqlite-shm b/config/iterm2/AppSupport/SavedState/restorable-state.sqlite-shm new file mode 100644 index 0000000..db610f4 Binary files /dev/null and b/config/iterm2/AppSupport/SavedState/restorable-state.sqlite-shm differ diff --git a/config/iterm2/AppSupport/SavedState/restorable-state.sqlite-wal b/config/iterm2/AppSupport/SavedState/restorable-state.sqlite-wal new file mode 100644 index 0000000..e69de29 diff --git a/config/iterm2/AppSupport/iTermServer-3.5.14 b/config/iterm2/AppSupport/iTermServer-3.5.14 new file mode 100755 index 0000000..bd7bfd2 Binary files /dev/null and b/config/iterm2/AppSupport/iTermServer-3.5.14 differ diff --git a/config/iterm2/AppSupport/iterm2-daemon-1.socket.lock b/config/iterm2/AppSupport/iterm2-daemon-1.socket.lock new file mode 100644 index 0000000..e69de29 diff --git a/config/iterm2/AppSupport/parsers/014e9c043e021d5c898148c90e74b61993eb25116b8144c57afaeb4f26359815 b/config/iterm2/AppSupport/parsers/014e9c043e021d5c898148c90e74b61993eb25116b8144c57afaeb4f26359815 new file mode 100644 index 0000000..03bbc77 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/014e9c043e021d5c898148c90e74b61993eb25116b8144c57afaeb4f26359815 differ diff --git a/config/iterm2/AppSupport/parsers/07be5fb0dae8eff07a6a3d7f3170589a5511b22b3df67db7eb602851a6d4dafa b/config/iterm2/AppSupport/parsers/07be5fb0dae8eff07a6a3d7f3170589a5511b22b3df67db7eb602851a6d4dafa new file mode 100644 index 0000000..99c1c35 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/07be5fb0dae8eff07a6a3d7f3170589a5511b22b3df67db7eb602851a6d4dafa differ diff --git a/config/iterm2/AppSupport/parsers/0a5568070904574c8beaf43792a98b70d7b287ffd2d87489fb72ada8d1a01147 b/config/iterm2/AppSupport/parsers/0a5568070904574c8beaf43792a98b70d7b287ffd2d87489fb72ada8d1a01147 new file mode 100644 index 0000000..efcc26a Binary files /dev/null and b/config/iterm2/AppSupport/parsers/0a5568070904574c8beaf43792a98b70d7b287ffd2d87489fb72ada8d1a01147 differ diff --git a/config/iterm2/AppSupport/parsers/19ff3c2e7a97b408f37ac456efb08d4542893275128f260856207e10c80b25d3 b/config/iterm2/AppSupport/parsers/19ff3c2e7a97b408f37ac456efb08d4542893275128f260856207e10c80b25d3 new file mode 100644 index 0000000..a9d40b9 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/19ff3c2e7a97b408f37ac456efb08d4542893275128f260856207e10c80b25d3 differ diff --git a/config/iterm2/AppSupport/parsers/237441b77ca9b490648eedd31753c856a747c7afeb3d109c380ded7b6b1bba5f b/config/iterm2/AppSupport/parsers/237441b77ca9b490648eedd31753c856a747c7afeb3d109c380ded7b6b1bba5f new file mode 100644 index 0000000..7945ef5 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/237441b77ca9b490648eedd31753c856a747c7afeb3d109c380ded7b6b1bba5f differ diff --git a/config/iterm2/AppSupport/parsers/275f6caa716172d04be44ede5c56bbd0491be254fe259e8720ac7f66f84e0692 b/config/iterm2/AppSupport/parsers/275f6caa716172d04be44ede5c56bbd0491be254fe259e8720ac7f66f84e0692 new file mode 100644 index 0000000..039ce14 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/275f6caa716172d04be44ede5c56bbd0491be254fe259e8720ac7f66f84e0692 differ diff --git a/config/iterm2/AppSupport/parsers/3bdd5312078fc9bbc979fbef6d64db3117afa4662ac9fb849e34dbb206e611b3 b/config/iterm2/AppSupport/parsers/3bdd5312078fc9bbc979fbef6d64db3117afa4662ac9fb849e34dbb206e611b3 new file mode 100644 index 0000000..e463dba Binary files /dev/null and b/config/iterm2/AppSupport/parsers/3bdd5312078fc9bbc979fbef6d64db3117afa4662ac9fb849e34dbb206e611b3 differ diff --git a/config/iterm2/AppSupport/parsers/3cd7b0d690b668dc409a5d602a65db327690b81a92d67cdec5ab0d86a78582b7 b/config/iterm2/AppSupport/parsers/3cd7b0d690b668dc409a5d602a65db327690b81a92d67cdec5ab0d86a78582b7 new file mode 100644 index 0000000..fde4981 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/3cd7b0d690b668dc409a5d602a65db327690b81a92d67cdec5ab0d86a78582b7 differ diff --git a/config/iterm2/AppSupport/parsers/47968eaa6beb856315113397c1b1c7848b7127dcd7bddb6df5380f941f8632d5 b/config/iterm2/AppSupport/parsers/47968eaa6beb856315113397c1b1c7848b7127dcd7bddb6df5380f941f8632d5 new file mode 100644 index 0000000..efd919f Binary files /dev/null and b/config/iterm2/AppSupport/parsers/47968eaa6beb856315113397c1b1c7848b7127dcd7bddb6df5380f941f8632d5 differ diff --git a/config/iterm2/AppSupport/parsers/5476e093fc2851a959a742e33c335100d6b78d6513c64f8a13b7ecafb651c3ac b/config/iterm2/AppSupport/parsers/5476e093fc2851a959a742e33c335100d6b78d6513c64f8a13b7ecafb651c3ac new file mode 100644 index 0000000..e053277 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/5476e093fc2851a959a742e33c335100d6b78d6513c64f8a13b7ecafb651c3ac differ diff --git a/config/iterm2/AppSupport/parsers/5e4e4fa0d96df576b939ee5587c50528f2dc395e4757b970f8b332aa4761f916 b/config/iterm2/AppSupport/parsers/5e4e4fa0d96df576b939ee5587c50528f2dc395e4757b970f8b332aa4761f916 new file mode 100644 index 0000000..1c96e40 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/5e4e4fa0d96df576b939ee5587c50528f2dc395e4757b970f8b332aa4761f916 differ diff --git a/config/iterm2/AppSupport/parsers/5ffd35febcfef2535ed536437d27ee3b19f0f52b885ce20070f7a4bfae82dd9e b/config/iterm2/AppSupport/parsers/5ffd35febcfef2535ed536437d27ee3b19f0f52b885ce20070f7a4bfae82dd9e new file mode 100644 index 0000000..4ef870f Binary files /dev/null and b/config/iterm2/AppSupport/parsers/5ffd35febcfef2535ed536437d27ee3b19f0f52b885ce20070f7a4bfae82dd9e differ diff --git a/config/iterm2/AppSupport/parsers/73aa6138edf938dbc34e1e7d868ceb0fb467dfd23631d63232b235913bfc1d60 b/config/iterm2/AppSupport/parsers/73aa6138edf938dbc34e1e7d868ceb0fb467dfd23631d63232b235913bfc1d60 new file mode 100644 index 0000000..6d7437a Binary files /dev/null and b/config/iterm2/AppSupport/parsers/73aa6138edf938dbc34e1e7d868ceb0fb467dfd23631d63232b235913bfc1d60 differ diff --git a/config/iterm2/AppSupport/parsers/753940570034705db2b7c35a66c82b4153119b129e3cbfc5a0bd0d05e1bc0976 b/config/iterm2/AppSupport/parsers/753940570034705db2b7c35a66c82b4153119b129e3cbfc5a0bd0d05e1bc0976 new file mode 100644 index 0000000..9f019c2 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/753940570034705db2b7c35a66c82b4153119b129e3cbfc5a0bd0d05e1bc0976 differ diff --git a/config/iterm2/AppSupport/parsers/776fb5db8d99438202acecacb37b7e1ed23be0bb0052a79da5d9495c74440e10 b/config/iterm2/AppSupport/parsers/776fb5db8d99438202acecacb37b7e1ed23be0bb0052a79da5d9495c74440e10 new file mode 100644 index 0000000..a9d40b9 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/776fb5db8d99438202acecacb37b7e1ed23be0bb0052a79da5d9495c74440e10 differ diff --git a/config/iterm2/AppSupport/parsers/8564005a2442ab34eb199e2fca2ee16d349b5cce53dc874c7439195a1314e0b9 b/config/iterm2/AppSupport/parsers/8564005a2442ab34eb199e2fca2ee16d349b5cce53dc874c7439195a1314e0b9 new file mode 100644 index 0000000..abe824e Binary files /dev/null and b/config/iterm2/AppSupport/parsers/8564005a2442ab34eb199e2fca2ee16d349b5cce53dc874c7439195a1314e0b9 differ diff --git a/config/iterm2/AppSupport/parsers/85dfcf6f3e327cf4cba1b2c2e0b0e9034c1657b158c125fa4969cb1dfb7fe069 b/config/iterm2/AppSupport/parsers/85dfcf6f3e327cf4cba1b2c2e0b0e9034c1657b158c125fa4969cb1dfb7fe069 new file mode 100644 index 0000000..0613902 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/85dfcf6f3e327cf4cba1b2c2e0b0e9034c1657b158c125fa4969cb1dfb7fe069 differ diff --git a/config/iterm2/AppSupport/parsers/85fbf58977cec86302f08bdce34825c892282a1e4d136f908272283398951a4c b/config/iterm2/AppSupport/parsers/85fbf58977cec86302f08bdce34825c892282a1e4d136f908272283398951a4c new file mode 100644 index 0000000..3ef4131 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/85fbf58977cec86302f08bdce34825c892282a1e4d136f908272283398951a4c differ diff --git a/config/iterm2/AppSupport/parsers/9a0055b7fd15226bdc28e4a6b0f3ff113425b8e08b55055ab4e8ed4e9d536f69 b/config/iterm2/AppSupport/parsers/9a0055b7fd15226bdc28e4a6b0f3ff113425b8e08b55055ab4e8ed4e9d536f69 new file mode 100644 index 0000000..c902562 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/9a0055b7fd15226bdc28e4a6b0f3ff113425b8e08b55055ab4e8ed4e9d536f69 differ diff --git a/config/iterm2/AppSupport/parsers/a4083865c238cfafe84ea863dee7da51d6a9b4551fa14c2de4eadb18a732882e b/config/iterm2/AppSupport/parsers/a4083865c238cfafe84ea863dee7da51d6a9b4551fa14c2de4eadb18a732882e new file mode 100644 index 0000000..a9d40b9 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/a4083865c238cfafe84ea863dee7da51d6a9b4551fa14c2de4eadb18a732882e differ diff --git a/config/iterm2/AppSupport/parsers/c9874942c9a010310d15ffe9317bcf195e0150a6ddc9dfb9dc19604e67e0a487 b/config/iterm2/AppSupport/parsers/c9874942c9a010310d15ffe9317bcf195e0150a6ddc9dfb9dc19604e67e0a487 new file mode 100644 index 0000000..fc624cc Binary files /dev/null and b/config/iterm2/AppSupport/parsers/c9874942c9a010310d15ffe9317bcf195e0150a6ddc9dfb9dc19604e67e0a487 differ diff --git a/config/iterm2/AppSupport/parsers/d17946795e97bedb4ba02018ccee43ab135edc04550447bfdaa33bebad7067a0 b/config/iterm2/AppSupport/parsers/d17946795e97bedb4ba02018ccee43ab135edc04550447bfdaa33bebad7067a0 new file mode 100644 index 0000000..30932cb Binary files /dev/null and b/config/iterm2/AppSupport/parsers/d17946795e97bedb4ba02018ccee43ab135edc04550447bfdaa33bebad7067a0 differ diff --git a/config/iterm2/AppSupport/parsers/d2ba5f33144c8b5daec6ee1f9852db010d1793e88a3e92fe872c6638f10616d0 b/config/iterm2/AppSupport/parsers/d2ba5f33144c8b5daec6ee1f9852db010d1793e88a3e92fe872c6638f10616d0 new file mode 100644 index 0000000..285bece Binary files /dev/null and b/config/iterm2/AppSupport/parsers/d2ba5f33144c8b5daec6ee1f9852db010d1793e88a3e92fe872c6638f10616d0 differ diff --git a/config/iterm2/AppSupport/parsers/dbb0c454709fad8e69d51af563f5cd64415b91eef8badfce48c1213f2f21e2be b/config/iterm2/AppSupport/parsers/dbb0c454709fad8e69d51af563f5cd64415b91eef8badfce48c1213f2f21e2be new file mode 100644 index 0000000..00469be Binary files /dev/null and b/config/iterm2/AppSupport/parsers/dbb0c454709fad8e69d51af563f5cd64415b91eef8badfce48c1213f2f21e2be differ diff --git a/config/iterm2/AppSupport/parsers/e3f349c138bbb78c81ad36c2d406f4f52aee3ccafe8f27a51cbdfb4050d5e7e0 b/config/iterm2/AppSupport/parsers/e3f349c138bbb78c81ad36c2d406f4f52aee3ccafe8f27a51cbdfb4050d5e7e0 new file mode 100644 index 0000000..ddd4130 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/e3f349c138bbb78c81ad36c2d406f4f52aee3ccafe8f27a51cbdfb4050d5e7e0 differ diff --git a/config/iterm2/AppSupport/parsers/e991cf04e5332b9b56291f4ce431b271836326eb46c838f411fa45be6bb493dc b/config/iterm2/AppSupport/parsers/e991cf04e5332b9b56291f4ce431b271836326eb46c838f411fa45be6bb493dc new file mode 100644 index 0000000..817eb9a Binary files /dev/null and b/config/iterm2/AppSupport/parsers/e991cf04e5332b9b56291f4ce431b271836326eb46c838f411fa45be6bb493dc differ diff --git a/config/iterm2/AppSupport/parsers/f0ad1d96a7c6885f10e3d668594b9670a748bd1088be77223828d74578e6e723 b/config/iterm2/AppSupport/parsers/f0ad1d96a7c6885f10e3d668594b9670a748bd1088be77223828d74578e6e723 new file mode 100644 index 0000000..428bab6 Binary files /dev/null and b/config/iterm2/AppSupport/parsers/f0ad1d96a7c6885f10e3d668594b9670a748bd1088be77223828d74578e6e723 differ diff --git a/config/iterm2/AppSupport/version.txt b/config/iterm2/AppSupport/version.txt new file mode 100644 index 0000000..4845dc4 --- /dev/null +++ b/config/iterm2/AppSupport/version.txt @@ -0,0 +1 @@ +3.5.14 \ No newline at end of file diff --git a/config/karabiner/automatic_backups/karabiner_20250326.json b/config/karabiner/automatic_backups/karabiner_20250326.json new file mode 100644 index 0000000..d68d301 --- /dev/null +++ b/config/karabiner/automatic_backups/karabiner_20250326.json @@ -0,0 +1,9 @@ +{ + "profiles": [ + { + "name": "Default profile", + "selected": true, + "virtual_hid_keyboard": { "keyboard_type_v2": "ansi" } + } + ] +} \ No newline at end of file diff --git a/config/karabiner/karabiner.json b/config/karabiner/karabiner.json new file mode 100644 index 0000000..536bb83 --- /dev/null +++ b/config/karabiner/karabiner.json @@ -0,0 +1,32 @@ +{ + "profiles": [ + { + "devices": [ + { + "identifiers": { + "is_keyboard": true, + "product_id": 402, + "vendor_id": 1241 + }, + "simple_modifications": [ + { + "from": { "key_code": "left_command" }, + "to": [{ "key_code": "left_option" }] + }, + { + "from": { "key_code": "left_option" }, + "to": [{ "key_code": "left_command" }] + }, + { + "from": { "key_code": "right_option" }, + "to": [{ "key_code": "right_command" }] + } + ] + } + ], + "name": "Default profile", + "selected": true, + "virtual_hid_keyboard": { "keyboard_type_v2": "ansi" } + } + ] +} \ No newline at end of file diff --git a/config/neofetch/config.conf b/config/neofetch/config.conf new file mode 100644 index 0000000..cdba4c6 --- /dev/null +++ b/config/neofetch/config.conf @@ -0,0 +1,864 @@ +# See this wiki page for more info: +# https://github.com/dylanaraps/neofetch/wiki/Customizing-Info +print_info() { + info title + info underline + + info "OS" distro + info "Host" model + info "Kernel" kernel + info "Uptime" uptime + info "Packages" packages + info "Shell" shell + info "Resolution" resolution + info "DE" de + info "WM" wm + info "WM Theme" wm_theme + info "Theme" theme + info "Icons" icons + info "Terminal" term + info "Terminal Font" term_font + info "CPU" cpu + info "GPU" gpu + info "Memory" memory + + # info "GPU Driver" gpu_driver # Linux/macOS only + # info "CPU Usage" cpu_usage + # info "Disk" disk + # info "Battery" battery + # info "Font" font + # info "Song" song + # [[ "$player" ]] && prin "Music Player" "$player" + # info "Local IP" local_ip + # info "Public IP" public_ip + # info "Users" users + # info "Locale" locale # This only works on glibc systems. + + info cols +} + +# Title + + +# Hide/Show Fully qualified domain name. +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --title_fqdn +title_fqdn="off" + + +# Kernel + + +# Shorten the output of the kernel function. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --kernel_shorthand +# Supports: Everything except *BSDs (except PacBSD and PC-BSD) +# +# Example: +# on: '4.8.9-1-ARCH' +# off: 'Linux 4.8.9-1-ARCH' +kernel_shorthand="on" + + +# Distro + + +# Shorten the output of the distro function +# +# Default: 'off' +# Values: 'on', 'tiny', 'off' +# Flag: --distro_shorthand +# Supports: Everything except Windows and Haiku +distro_shorthand="off" + +# Show/Hide OS Architecture. +# Show 'x86_64', 'x86' and etc in 'Distro:' output. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --os_arch +# +# Example: +# on: 'Arch Linux x86_64' +# off: 'Arch Linux' +os_arch="on" + + +# Uptime + + +# Shorten the output of the uptime function +# +# Default: 'on' +# Values: 'on', 'tiny', 'off' +# Flag: --uptime_shorthand +# +# Example: +# on: '2 days, 10 hours, 3 mins' +# tiny: '2d 10h 3m' +# off: '2 days, 10 hours, 3 minutes' +uptime_shorthand="on" + + +# Memory + + +# Show memory pecentage in output. +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --memory_percent +# +# Example: +# on: '1801MiB / 7881MiB (22%)' +# off: '1801MiB / 7881MiB' +memory_percent="off" + +# Change memory output unit. +# +# Default: 'mib' +# Values: 'kib', 'mib', 'gib' +# Flag: --memory_unit +# +# Example: +# kib '1020928KiB / 7117824KiB' +# mib '1042MiB / 6951MiB' +# gib: ' 0.98GiB / 6.79GiB' +memory_unit="mib" + + +# Packages + + +# Show/Hide Package Manager names. +# +# Default: 'tiny' +# Values: 'on', 'tiny' 'off' +# Flag: --package_managers +# +# Example: +# on: '998 (pacman), 8 (flatpak), 4 (snap)' +# tiny: '908 (pacman, flatpak, snap)' +# off: '908' +package_managers="on" + + +# Shell + + +# Show the path to $SHELL +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --shell_path +# +# Example: +# on: '/bin/bash' +# off: 'bash' +shell_path="off" + +# Show $SHELL version +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --shell_version +# +# Example: +# on: 'bash 4.4.5' +# off: 'bash' +shell_version="on" + + +# CPU + + +# CPU speed type +# +# Default: 'bios_limit' +# Values: 'scaling_cur_freq', 'scaling_min_freq', 'scaling_max_freq', 'bios_limit'. +# Flag: --speed_type +# Supports: Linux with 'cpufreq' +# NOTE: Any file in '/sys/devices/system/cpu/cpu0/cpufreq' can be used as a value. +speed_type="bios_limit" + +# CPU speed shorthand +# +# Default: 'off' +# Values: 'on', 'off'. +# Flag: --speed_shorthand +# NOTE: This flag is not supported in systems with CPU speed less than 1 GHz +# +# Example: +# on: 'i7-6500U (4) @ 3.1GHz' +# off: 'i7-6500U (4) @ 3.100GHz' +speed_shorthand="off" + +# Enable/Disable CPU brand in output. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --cpu_brand +# +# Example: +# on: 'Intel i7-6500U' +# off: 'i7-6500U (4)' +cpu_brand="on" + +# CPU Speed +# Hide/Show CPU speed. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --cpu_speed +# +# Example: +# on: 'Intel i7-6500U (4) @ 3.1GHz' +# off: 'Intel i7-6500U (4)' +cpu_speed="on" + +# CPU Cores +# Display CPU cores in output +# +# Default: 'logical' +# Values: 'logical', 'physical', 'off' +# Flag: --cpu_cores +# Support: 'physical' doesn't work on BSD. +# +# Example: +# logical: 'Intel i7-6500U (4) @ 3.1GHz' (All virtual cores) +# physical: 'Intel i7-6500U (2) @ 3.1GHz' (All physical cores) +# off: 'Intel i7-6500U @ 3.1GHz' +cpu_cores="logical" + +# CPU Temperature +# Hide/Show CPU temperature. +# Note the temperature is added to the regular CPU function. +# +# Default: 'off' +# Values: 'C', 'F', 'off' +# Flag: --cpu_temp +# Supports: Linux, BSD +# NOTE: For FreeBSD and NetBSD-based systems, you'll need to enable +# coretemp kernel module. This only supports newer Intel processors. +# +# Example: +# C: 'Intel i7-6500U (4) @ 3.1GHz [27.2Β°C]' +# F: 'Intel i7-6500U (4) @ 3.1GHz [82.0Β°F]' +# off: 'Intel i7-6500U (4) @ 3.1GHz' +cpu_temp="off" + + +# GPU + + +# Enable/Disable GPU Brand +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gpu_brand +# +# Example: +# on: 'AMD HD 7950' +# off: 'HD 7950' +gpu_brand="on" + +# Which GPU to display +# +# Default: 'all' +# Values: 'all', 'dedicated', 'integrated' +# Flag: --gpu_type +# Supports: Linux +# +# Example: +# all: +# GPU1: AMD HD 7950 +# GPU2: Intel Integrated Graphics +# +# dedicated: +# GPU1: AMD HD 7950 +# +# integrated: +# GPU1: Intel Integrated Graphics +gpu_type="all" + + +# Resolution + + +# Display refresh rate next to each monitor +# Default: 'off' +# Values: 'on', 'off' +# Flag: --refresh_rate +# Supports: Doesn't work on Windows. +# +# Example: +# on: '1920x1080 @ 60Hz' +# off: '1920x1080' +refresh_rate="off" + + +# Gtk Theme / Icons / Font + + +# Shorten output of GTK Theme / Icons / Font +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --gtk_shorthand +# +# Example: +# on: 'Numix, Adwaita' +# off: 'Numix [GTK2], Adwaita [GTK3]' +gtk_shorthand="off" + + +# Enable/Disable gtk2 Theme / Icons / Font +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gtk2 +# +# Example: +# on: 'Numix [GTK2], Adwaita [GTK3]' +# off: 'Adwaita [GTK3]' +gtk2="on" + +# Enable/Disable gtk3 Theme / Icons / Font +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --gtk3 +# +# Example: +# on: 'Numix [GTK2], Adwaita [GTK3]' +# off: 'Numix [GTK2]' +gtk3="on" + + +# IP Address + + +# Website to ping for the public IP +# +# Default: 'http://ident.me' +# Values: 'url' +# Flag: --ip_host +public_ip_host="http://ident.me" + +# Public IP timeout. +# +# Default: '2' +# Values: 'int' +# Flag: --ip_timeout +public_ip_timeout=2 + + +# Desktop Environment + + +# Show Desktop Environment version +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --de_version +de_version="on" + + +# Disk + + +# Which disks to display. +# The values can be any /dev/sdXX, mount point or directory. +# NOTE: By default we only show the disk info for '/'. +# +# Default: '/' +# Values: '/', '/dev/sdXX', '/path/to/drive'. +# Flag: --disk_show +# +# Example: +# disk_show=('/' '/dev/sdb1'): +# 'Disk (/): 74G / 118G (66%)' +# 'Disk (/mnt/Videos): 823G / 893G (93%)' +# +# disk_show=('/'): +# 'Disk (/): 74G / 118G (66%)' +# +disk_show=('/') + +# Disk subtitle. +# What to append to the Disk subtitle. +# +# Default: 'mount' +# Values: 'mount', 'name', 'dir', 'none' +# Flag: --disk_subtitle +# +# Example: +# name: 'Disk (/dev/sda1): 74G / 118G (66%)' +# 'Disk (/dev/sdb2): 74G / 118G (66%)' +# +# mount: 'Disk (/): 74G / 118G (66%)' +# 'Disk (/mnt/Local Disk): 74G / 118G (66%)' +# 'Disk (/mnt/Videos): 74G / 118G (66%)' +# +# dir: 'Disk (/): 74G / 118G (66%)' +# 'Disk (Local Disk): 74G / 118G (66%)' +# 'Disk (Videos): 74G / 118G (66%)' +# +# none: 'Disk: 74G / 118G (66%)' +# 'Disk: 74G / 118G (66%)' +# 'Disk: 74G / 118G (66%)' +disk_subtitle="mount" + +# Disk percent. +# Show/Hide disk percent. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --disk_percent +# +# Example: +# on: 'Disk (/): 74G / 118G (66%)' +# off: 'Disk (/): 74G / 118G' +disk_percent="on" + + +# Song + + +# Manually specify a music player. +# +# Default: 'auto' +# Values: 'auto', 'player-name' +# Flag: --music_player +# +# Available values for 'player-name': +# +# amarok +# audacious +# banshee +# bluemindo +# clementine +# cmus +# deadbeef +# deepin-music +# dragon +# elisa +# exaile +# gnome-music +# gmusicbrowser +# gogglesmm +# guayadeque +# io.elementary.music +# iTunes +# juk +# lollypop +# mocp +# mopidy +# mpd +# muine +# netease-cloud-music +# olivia +# playerctl +# pogo +# pragha +# qmmp +# quodlibet +# rhythmbox +# sayonara +# smplayer +# spotify +# strawberry +# tauonmb +# tomahawk +# vlc +# xmms2d +# xnoise +# yarock +music_player="auto" + +# Format to display song information. +# +# Default: '%artist% - %album% - %title%' +# Values: '%artist%', '%album%', '%title%' +# Flag: --song_format +# +# Example: +# default: 'Song: Jet - Get Born - Sgt Major' +song_format="%artist% - %album% - %title%" + +# Print the Artist, Album and Title on separate lines +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --song_shorthand +# +# Example: +# on: 'Artist: The Fratellis' +# 'Album: Costello Music' +# 'Song: Chelsea Dagger' +# +# off: 'Song: The Fratellis - Costello Music - Chelsea Dagger' +song_shorthand="off" + +# 'mpc' arguments (specify a host, password etc). +# +# Default: '' +# Example: mpc_args=(-h HOST -P PASSWORD) +mpc_args=() + + +# Text Colors + + +# Text Colors +# +# Default: 'distro' +# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' +# Flag: --colors +# +# Each number represents a different part of the text in +# this order: 'title', '@', 'underline', 'subtitle', 'colon', 'info' +# +# Example: +# colors=(distro) - Text is colored based on Distro colors. +# colors=(4 6 1 8 8 6) - Text is colored in the order above. +colors=(distro) + + +# Text Options + + +# Toggle bold text +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --bold +bold="on" + +# Enable/Disable Underline +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --underline +underline_enabled="on" + +# Underline character +# +# Default: '-' +# Values: 'string' +# Flag: --underline_char +underline_char="-" + + +# Info Separator +# Replace the default separator with the specified string. +# +# Default: ':' +# Flag: --separator +# +# Example: +# separator="->": 'Shell-> bash' +# separator=" =": 'WM = dwm' +separator=":" + + +# Color Blocks + + +# Color block range +# The range of colors to print. +# +# Default: '0', '15' +# Values: 'num' +# Flag: --block_range +# +# Example: +# +# Display colors 0-7 in the blocks. (8 colors) +# neofetch --block_range 0 7 +# +# Display colors 0-15 in the blocks. (16 colors) +# neofetch --block_range 0 15 +block_range=(0 15) + +# Toggle color blocks +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --color_blocks +color_blocks="on" + +# Color block width in spaces +# +# Default: '3' +# Values: 'num' +# Flag: --block_width +block_width=3 + +# Color block height in lines +# +# Default: '1' +# Values: 'num' +# Flag: --block_height +block_height=1 + +# Color Alignment +# +# Default: 'auto' +# Values: 'auto', 'num' +# Flag: --col_offset +# +# Number specifies how far from the left side of the terminal (in spaces) to +# begin printing the columns, in case you want to e.g. center them under your +# text. +# Example: +# col_offset="auto" - Default behavior of neofetch +# col_offset=7 - Leave 7 spaces then print the colors +col_offset="auto" + +# Progress Bars + + +# Bar characters +# +# Default: '-', '=' +# Values: 'string', 'string' +# Flag: --bar_char +# +# Example: +# neofetch --bar_char 'elapsed' 'total' +# neofetch --bar_char '-' '=' +bar_char_elapsed="-" +bar_char_total="=" + +# Toggle Bar border +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --bar_border +bar_border="on" + +# Progress bar length in spaces +# Number of chars long to make the progress bars. +# +# Default: '15' +# Values: 'num' +# Flag: --bar_length +bar_length=15 + +# Progress bar colors +# When set to distro, uses your distro's logo colors. +# +# Default: 'distro', 'distro' +# Values: 'distro', 'num' +# Flag: --bar_colors +# +# Example: +# neofetch --bar_colors 3 4 +# neofetch --bar_colors distro 5 +bar_color_elapsed="distro" +bar_color_total="distro" + + +# Info display +# Display a bar with the info. +# +# Default: 'off' +# Values: 'bar', 'infobar', 'barinfo', 'off' +# Flags: --cpu_display +# --memory_display +# --battery_display +# --disk_display +# +# Example: +# bar: '[---=======]' +# infobar: 'info [---=======]' +# barinfo: '[---=======] info' +# off: 'info' +cpu_display="off" +memory_display="off" +battery_display="off" +disk_display="off" + + +# Backend Settings + + +# Image backend. +# +# Default: 'ascii' +# Values: 'ascii', 'caca', 'chafa', 'jp2a', 'iterm2', 'off', +# 'pot', 'termpix', 'pixterm', 'tycat', 'w3m', 'kitty' +# Flag: --backend +image_backend="ascii" + +# Image Source +# +# Which image or ascii file to display. +# +# Default: 'auto' +# Values: 'auto', 'ascii', 'wallpaper', '/path/to/img', '/path/to/ascii', '/path/to/dir/' +# 'command output (neofetch --ascii "$(fortune | cowsay -W 30)")' +# Flag: --source +# +# NOTE: 'auto' will pick the best image source for whatever image backend is used. +# In ascii mode, distro ascii art will be used and in an image mode, your +# wallpaper will be used. +image_source="auto" + + +# Ascii Options + + +# Ascii distro +# Which distro's ascii art to display. +# +# Default: 'auto' +# Values: 'auto', 'distro_name' +# Flag: --ascii_distro +# NOTE: AIX, Alpine, Anarchy, Android, Antergos, antiX, "AOSC OS", +# "AOSC OS/Retro", Apricity, ArcoLinux, ArchBox, ARCHlabs, +# ArchStrike, XFerience, ArchMerge, Arch, Artix, Arya, Bedrock, +# Bitrig, BlackArch, BLAG, BlankOn, BlueLight, bonsai, BSD, +# BunsenLabs, Calculate, Carbs, CentOS, Chakra, ChaletOS, +# Chapeau, Chrom*, Cleanjaro, ClearOS, Clear_Linux, Clover, +# Condres, Container_Linux, CRUX, Cucumber, Debian, Deepin, +# DesaOS, Devuan, DracOS, DarkOs, DragonFly, Drauger, Elementary, +# EndeavourOS, Endless, EuroLinux, Exherbo, Fedora, Feren, FreeBSD, +# FreeMiNT, Frugalware, Funtoo, GalliumOS, Garuda, Gentoo, Pentoo, +# gNewSense, GNOME, GNU, GoboLinux, Grombyang, Guix, Haiku, Huayra, +# Hyperbola, janus, Kali, KaOS, KDE_neon, Kibojoe, Kogaion, +# Korora, KSLinux, Kubuntu, LEDE, LFS, Linux_Lite, +# LMDE, Lubuntu, Lunar, macos, Mageia, MagpieOS, Mandriva, +# Manjaro, Maui, Mer, Minix, LinuxMint, MX_Linux, Namib, +# Neptune, NetBSD, Netrunner, Nitrux, NixOS, Nurunner, +# NuTyX, OBRevenge, OpenBSD, openEuler, OpenIndiana, openmamba, +# OpenMandriva, OpenStage, OpenWrt, osmc, Oracle, OS Elbrus, PacBSD, +# Parabola, Pardus, Parrot, Parsix, TrueOS, PCLinuxOS, Peppermint, +# popos, Porteus, PostMarketOS, Proxmox, Puppy, PureOS, Qubes, Radix, +# Raspbian, Reborn_OS, Redstar, Redcore, Redhat, Refracted_Devuan, +# Regata, Rosa, sabotage, Sabayon, Sailfish, SalentOS, Scientific, +# Septor, SereneLinux, SharkLinux, Siduction, Slackware, SliTaz, +# SmartOS, Solus, Source_Mage, Sparky, Star, SteamOS, SunOS, +# openSUSE_Leap, openSUSE_Tumbleweed, openSUSE, SwagArch, Tails, +# Trisquel, Ubuntu-Budgie, Ubuntu-GNOME, Ubuntu-MATE, Ubuntu-Studio, +# Ubuntu, Venom, Void, Obarun, windows10, Windows7, Xubuntu, Zorin, +# and IRIX have ascii logos +# NOTE: Arch, Ubuntu, Redhat, and Dragonfly have 'old' logo variants. +# Use '{distro name}_old' to use the old logos. +# NOTE: Ubuntu has flavor variants. +# Change this to Lubuntu, Kubuntu, Xubuntu, Ubuntu-GNOME, +# Ubuntu-Studio, Ubuntu-Mate or Ubuntu-Budgie to use the flavors. +# NOTE: Arcolinux, Dragonfly, Fedora, Alpine, Arch, Ubuntu, +# CRUX, Debian, Gentoo, FreeBSD, Mac, NixOS, OpenBSD, android, +# Antrix, CentOS, Cleanjaro, ElementaryOS, GUIX, Hyperbola, +# Manjaro, MXLinux, NetBSD, Parabola, POP_OS, PureOS, +# Slackware, SunOS, LinuxLite, OpenSUSE, Raspbian, +# postmarketOS, and Void have a smaller logo variant. +# Use '{distro name}_small' to use the small variants. +ascii_distro="auto" + +# Ascii Colors +# +# Default: 'distro' +# Values: 'distro', 'num' 'num' 'num' 'num' 'num' 'num' +# Flag: --ascii_colors +# +# Example: +# ascii_colors=(distro) - Ascii is colored based on Distro colors. +# ascii_colors=(4 6 1 8 8 6) - Ascii is colored using these colors. +ascii_colors=(distro) + +# Bold ascii logo +# Whether or not to bold the ascii logo. +# +# Default: 'on' +# Values: 'on', 'off' +# Flag: --ascii_bold +ascii_bold="on" + + +# Image Options + + +# Image loop +# Setting this to on will make neofetch redraw the image constantly until +# Ctrl+C is pressed. This fixes display issues in some terminal emulators. +# +# Default: 'off' +# Values: 'on', 'off' +# Flag: --loop +image_loop="off" + +# Thumbnail directory +# +# Default: '~/.cache/thumbnails/neofetch' +# Values: 'dir' +thumbnail_dir="${XDG_CACHE_HOME:-${HOME}/.cache}/thumbnails/neofetch" + +# Crop mode +# +# Default: 'normal' +# Values: 'normal', 'fit', 'fill' +# Flag: --crop_mode +# +# See this wiki page to learn about the fit and fill options. +# https://github.com/dylanaraps/neofetch/wiki/What-is-Waifu-Crop%3F +crop_mode="normal" + +# Crop offset +# Note: Only affects 'normal' crop mode. +# +# Default: 'center' +# Values: 'northwest', 'north', 'northeast', 'west', 'center' +# 'east', 'southwest', 'south', 'southeast' +# Flag: --crop_offset +crop_offset="center" + +# Image size +# The image is half the terminal width by default. +# +# Default: 'auto' +# Values: 'auto', '00px', '00%', 'none' +# Flags: --image_size +# --size +image_size="auto" + +# Gap between image and text +# +# Default: '3' +# Values: 'num', '-num' +# Flag: --gap +gap=3 + +# Image offsets +# Only works with the w3m backend. +# +# Default: '0' +# Values: 'px' +# Flags: --xoffset +# --yoffset +yoffset=0 +xoffset=0 + +# Image background color +# Only works with the w3m backend. +# +# Default: '' +# Values: 'color', 'blue' +# Flag: --bg_color +background_color= + + +# Misc Options + +# Stdout mode +# Turn off all colors and disables image backend (ASCII/Image). +# Useful for piping into another command. +# Default: 'off' +# Values: 'on', 'off' +stdout="off" diff --git a/config/swiftbar/plugins/moon-phase.1h.sh b/config/swiftbar/plugins/moon-phase.1h.sh new file mode 100755 index 0000000..f4c5cac --- /dev/null +++ b/config/swiftbar/plugins/moon-phase.1h.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +# πŸŒ™ SwiftBar Plugin: Symbolic Moon Phase Monitor +# Author: GPT + David +# Requires: curl, jq, awk +# Caches data for 6h to reduce API use + +API_KEY="6ec71a8170214d828c08ba8bf2ca29e9" +CURL="/usr/bin/curl" +JQ="/usr/bin/jq" +AWK="/usr/bin/awk" +CACHE_FILE="$HOME/.cache/moonphase.json" +STATE_FILE="$HOME/.lunarstate" +MAX_AGE_HOURS=6 + +mkdir -p "$(dirname "$CACHE_FILE")" + +# Check cache freshness +NEEDS_UPDATE=true +if [ -f "$CACHE_FILE" ]; then + MOD_UNIX=$(stat -f "%m" "$CACHE_FILE") + NOW_UNIX=$(date +%s) + AGE_HOURS=$(( (NOW_UNIX - MOD_UNIX) / 3600 )) + [ "$AGE_HOURS" -lt "$MAX_AGE_HOURS" ] && NEEDS_UPDATE=false +fi + +# Fetch and cache +if [ "$NEEDS_UPDATE" = true ]; then + MOON_JSON=$($CURL -s "https://api.ipgeolocation.io/astronomy?apiKey=$API_KEY") + echo "$MOON_JSON" > "$CACHE_FILE" +else + MOON_JSON=$(cat "$CACHE_FILE") +fi + +# Extract fields +PHASE=$(echo "$MOON_JSON" | $JQ -r '.moon_phase') +ILLUM=$(echo "$MOON_JSON" | $JQ -r '.moon_illumination_percentage' | $AWK '{printf "%.0f", $1}') +MOONRISE=$(echo "$MOON_JSON" | $JQ -r '.moonrise') +MOONSET=$(echo "$MOON_JSON" | $JQ -r '.moonset') + +PHASE_LC=$(echo "$PHASE" | tr '[:upper:]' '[:lower:]') + +# Ritual glyphs & poetic names +declare -A ICONS=( + ["new_moon"]="πŸŒ‘" + ["waxing_crescent"]="πŸŒ’" + ["first_quarter"]="πŸŒ“" + ["waxing_gibbous"]="πŸŒ”" + ["full_moon"]="πŸŒ•" + ["waning_gibbous"]="πŸŒ–" + ["last_quarter"]="πŸŒ—" + ["waning_crescent"]="🌘" +) +declare -A POETIC=( + ["new_moon"]="Veiled Mother" + ["waxing_crescent"]="Hesitant Flame" + ["first_quarter"]="Climbing Eye" + ["waxing_gibbous"]="Gathering Tide" + ["full_moon"]="Revealed Bride" + ["waning_gibbous"]="Harvest Wane" + ["last_quarter"]="Parting Mirror" + ["waning_crescent"]="Waning Daughter" +) + +ICON="${ICONS[$PHASE_LC]:-❓}" +POETIC_NAME="${POETIC[$PHASE_LC]:-Unknown Phase}" + +# Direction +ARROW="⬆" +[[ "$PHASE_LC" =~ ^(full_moon|waning_gibbous|last_quarter|waning_crescent)$ ]] && ARROW="⬇" + +# Ritual detection +NOTICE="" +if [[ "$PHASE_LC" == "full_moon" ]]; then + NOTICE="☽ FULL RITE ☾" +elif [[ "$PHASE_LC" == "new_moon" ]]; then + NOTICE="β˜‰ NEW SILENCE β˜‰" +fi + +# Output to menubar +echo "$ICON $ARROW ${ILLUM}%" +echo "---" +echo "Phase: $(echo "$PHASE" | tr '_' ' ' | awk '{for (i=1; i<=NF; i++) $i=toupper(substr($i,1,1)) substr($i,2)} 1')" +echo "Poetic: $POETIC_NAME" +echo "Illumination: ${ILLUM}%" +echo "Moonrise: $MOONRISE" +echo "Moonset: $MOONSET" +[ -n "$NOTICE" ] && echo "$NOTICE" +echo "Last updated: $(date -r "$CACHE_FILE" "+%H:%M %Z")" + +# Optional: write state file for system rituals +echo "$PHASE_LC,$ILLUM,$POETIC_NAME,$NOTICE" > "$STATE_FILE" \ No newline at end of file diff --git a/gnupg/dirmngr.conf b/gnupg/dirmngr.conf new file mode 100644 index 0000000..1411414 --- /dev/null +++ b/gnupg/dirmngr.conf @@ -0,0 +1 @@ +keyserver hkps://keys.openpgp.org diff --git a/gnupg/gpg-agent.conf b/gnupg/gpg-agent.conf new file mode 100644 index 0000000..d586a17 --- /dev/null +++ b/gnupg/gpg-agent.conf @@ -0,0 +1,2 @@ +default-cache-ttl 600 +max-cache-ttl 7200 diff --git a/gnupg/gpg.conf b/gnupg/gpg.conf new file mode 100644 index 0000000..52776e4 --- /dev/null +++ b/gnupg/gpg.conf @@ -0,0 +1,3 @@ +auto-key-retrieve +no-emit-version +default-key 6B1BC020D66A948E81D71625D1ABEA25B68717DE diff --git a/pass-templates/README.md b/pass-templates/README.md new file mode 100644 index 0000000..fe1951c --- /dev/null +++ b/pass-templates/README.md @@ -0,0 +1,183 @@ +# Pass License Management + +A thoughtful, durable solution for managing software licenses and sensitive text data using the Unix philosophy. + +## Overview + +Pass (the standard Unix password manager) uses GPG encryption to securely store licenses, API keys, and other sensitive information. Everything is stored as GPG-encrypted files in `~/.password-store/`, making it version-controllable and portable. + +## Initial Setup + +Pass is already configured with your GPG key. If you need to reinitialize: +```bash +pass init YOUR-GPG-KEY-ID +``` + +## Daily Workflow + +### Adding New Licenses + +**Method 1: Using the helper script (recommended)** +```bash +new-license "AppName" +# Opens BBEdit with the license template +``` + +**Method 2: Direct entry** +```bash +pass edit licenses/AppName +# Opens BBEdit with a blank file +``` + +**Method 3: Quick single-line entry** +```bash +echo "LICENSE-KEY-HERE" | pass insert licenses/AppName +``` + +### Viewing Licenses + +```bash +# List all licenses +pass ls licenses/ + +# View specific license +pass show licenses/BBEdit + +# Copy license key to clipboard (first line only) +pass -c licenses/BBEdit + +# Copy specific line to clipboard (e.g., line 2) +pass show licenses/BBEdit | sed -n '2p' | pbcopy +``` + +### Searching Licenses + +```bash +# Search across all stored data +pass grep "adobe" +pass grep "scanner" +``` + +### Editing Existing Licenses + +```bash +pass edit licenses/AppName +# Opens in BBEdit for editing +``` + +### Removing Licenses + +```bash +# Remove single license +pass rm licenses/AppName + +# Remove with confirmation prompt +pass rm -i licenses/AppName +``` + +## Organization Structure + +Recommended hierarchy for different types of sensitive data: + +``` +~/.password-store/ +β”œβ”€β”€ licenses/ +β”‚ β”œβ”€β”€ adobe/ +β”‚ β”‚ β”œβ”€β”€ photoshop +β”‚ β”‚ └── illustrator +β”‚ β”œβ”€β”€ microsoft/ +β”‚ β”‚ └── office +β”‚ β”œβ”€β”€ BBEdit +β”‚ β”œβ”€β”€ VueScan +β”‚ └── Bartender +β”œβ”€β”€ api-keys/ +β”‚ β”œβ”€β”€ github +β”‚ β”œβ”€β”€ openai +β”‚ └── stripe +└── servers/ + β”œβ”€β”€ production + └── staging +``` + +Create subdirectories as needed: +```bash +pass insert licenses/adobe/photoshop +pass insert api-keys/github +``` + +## License Template + +The template at `~/dotfiles/pass-templates/license-template.txt` contains: +``` +Application: APPLICATION_NAME +License Key: LICENSE_KEY_HERE +Email: REGISTERED_EMAIL +Name: REGISTERED_NAME +Purchase Date: YYYY-MM-DD +Purchase Price: $AMOUNT +Vendor: VENDOR_NAME +Notes: Any additional notes about the license +``` + +## Integration with Notes.app + +For redundancy, you can keep copies in Notes.app: +1. Create a "Software Licenses" folder in Notes +2. Create secure notes (lock icon) for each license +3. This provides iCloud sync and an additional backup + +## Backup Strategy + +Your Pass data is backed up in three ways: +1. **Encrypted in dotfiles backup**: `~/dotfiles/backups/complete/all_secrets_*.tar.gz.gpg` +2. **Version controlled**: Can add `~/.password-store/` to git +3. **Manual backup**: `tar -czf pass-backup.tar.gz ~/.password-store/` + +## Advanced Usage + +### Generate passwords +```bash +pass generate accounts/example.com 20 +``` + +### Git integration +```bash +cd ~/.password-store +git init +git add . +git commit -m "Initial pass store" +``` + +### Multiple line clipboard +```bash +# Copy email from license entry +pass show licenses/BBEdit | grep "Email:" | cut -d' ' -f2 | pbcopy +``` + +### Temporary display (clears after 45 seconds) +```bash +pass show -c licenses/BBEdit +``` + +## Troubleshooting + +**BBEdit doesn't wait**: Ensure `EDITOR="bbedit -w"` is set in your shell + +**GPG key issues**: Check with `gpg --list-secret-keys` + +**Can't decrypt**: Ensure GPG agent is running: `gpgconf --launch gpg-agent` + +## Security Notes + +- All data is encrypted with your GPG key +- Temporary files are created in secure locations and cleaned up +- Clipboard is cleared after 45 seconds when using `-c` +- Never commit `.password-store/` to public repositories + +## Prime Directive Alignment + +This solution embodies μέτρον (measure and proportion): +- **Durable**: Plain text files, GPG encryption, Unix philosophy +- **Thoughtful**: Organized structure, templates for consistency +- **Portable**: Works on any system with GPG and pass +- **Secure**: Industry-standard encryption, no proprietary formats \ No newline at end of file diff --git a/pass-templates/license-template.txt b/pass-templates/license-template.txt new file mode 100644 index 0000000..f7a719d --- /dev/null +++ b/pass-templates/license-template.txt @@ -0,0 +1,8 @@ +Application: APPLICATION_NAME +License Key: LICENSE_KEY_HERE +Email: REGISTERED_EMAIL +Name: REGISTERED_NAME +Purchase Date: YYYY-MM-DD +Purchase Price: $AMOUNT +Vendor: VENDOR_NAME +Notes: Any additional notes about the license \ No newline at end of file diff --git a/scripts/backup-all-secrets.sh b/scripts/backup-all-secrets.sh new file mode 100755 index 0000000..41a659c --- /dev/null +++ b/scripts/backup-all-secrets.sh @@ -0,0 +1,144 @@ +#!/usr/bin/env bash +# Complete backup of all private keys, secrets, and sensitive configurations +# Following prime directive: one durable, encrypted container for everything + +set -euo pipefail + +BACKUP_DIR="$HOME/dotfiles/backups" +TIMESTAMP=$(date +%Y%m%d_%H%M%S) +TEMP_DIR=$(mktemp -d) + +# Colors +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' + +echo -e "${YELLOW}πŸ” Creating complete encrypted backup of all secrets${NC}" +echo "Timestamp: $TIMESTAMP" +echo "" + +# Create backup structure in temp directory +mkdir -p "$TEMP_DIR/secrets"/{ssh,gnupg,docker,config} + +echo -e "${YELLOW}πŸ“¦ Collecting all sensitive data...${NC}" + +# SSH keys and config +if [[ -d "$HOME/.ssh" ]]; then + echo " πŸ”‘ SSH keys and configuration" + cp -r "$HOME/.ssh" "$TEMP_DIR/secrets/" +fi + +# GPG keyring and keys +if [[ -d "$HOME/.gnupg" ]]; then + echo " πŸ” GPG private keys and keyring" + mkdir -p "$TEMP_DIR/secrets/.gnupg" + + # Copy essential GPG files (not temporary/socket files) + cp -r "$HOME/.gnupg/private-keys-v1.d" "$TEMP_DIR/secrets/.gnupg/" 2>/dev/null || true + cp "$HOME/.gnupg/pubring.kbx" "$TEMP_DIR/secrets/.gnupg/" 2>/dev/null || true + cp "$HOME/.gnupg/trustdb.gpg" "$TEMP_DIR/secrets/.gnupg/" 2>/dev/null || true + cp "$HOME/.gnupg/gpg.conf" "$TEMP_DIR/secrets/.gnupg/" 2>/dev/null || true + cp "$HOME/.gnupg/gpg-agent.conf" "$TEMP_DIR/secrets/.gnupg/" 2>/dev/null || true + cp "$HOME/.gnupg/dirmngr.conf" "$TEMP_DIR/secrets/.gnupg/" 2>/dev/null || true +fi + +# Docker configuration +if [[ -f "$HOME/.docker/config.json" ]]; then + echo " 🐳 Docker authentication" + mkdir -p "$TEMP_DIR/secrets/.docker" + cp "$HOME/.docker/config.json" "$TEMP_DIR/secrets/.docker/" +fi + +# Any license files or certificates (if found) +if [[ -f "$HOME/.vuescanrc" ]]; then + echo " πŸ“„ VueScan license" + cp "$HOME/.vuescanrc" "$TEMP_DIR/secrets/" +fi + +echo "" +echo -e "${YELLOW}πŸ—œοΈ Creating encrypted archive...${NC}" + +# Create the master encrypted backup +mkdir -p "$BACKUP_DIR/complete" +tar -czf - -C "$TEMP_DIR" secrets | \ +gpg --symmetric --cipher-algo AES256 --compress-algo 2 \ + --output "$BACKUP_DIR/complete/all_secrets_${TIMESTAMP}.tar.gz.gpg" + +# Create comprehensive restore instructions +cat > "$BACKUP_DIR/complete/RESTORE_INSTRUCTIONS.md" << 'EOF' +# Complete Secrets Restore Instructions + +## Master Encrypted Backup + +This is your complete backup of all private keys, certificates, and sensitive configurations. + +### What's Included +- SSH keys and configuration +- GPG private keys and keyring +- Docker authentication +- Application licenses +- Any other sensitive configuration files + +### Restore Process + +#### Step 1: Decrypt the backup +```bash +gpg --decrypt all_secrets_TIMESTAMP.tar.gz.gpg > all_secrets_TIMESTAMP.tar.gz +``` + +#### Step 2: Extract to temporary location first +```bash +mkdir ~/restore_temp +tar -xzf all_secrets_TIMESTAMP.tar.gz -C ~/restore_temp +``` + +#### Step 3: Review and restore selectively +```bash +# SSH (if needed) +cp -r ~/restore_temp/secrets/.ssh ~/ +chmod 700 ~/.ssh +chmod 600 ~/.ssh/config ~/.ssh/*_rsa ~/.ssh/id_* +chmod 644 ~/.ssh/*.pub + +# GPG (if needed) +cp -r ~/restore_temp/secrets/.gnupg ~/ +chmod 700 ~/.gnupg +chmod 600 ~/.gnupg/* +chmod 700 ~/.gnupg/private-keys-v1.d +chmod 600 ~/.gnupg/private-keys-v1.d/* +gpgconf --kill gpg-agent # Restart GPG agent + +# Docker (if needed) +mkdir -p ~/.docker +cp ~/restore_temp/secrets/.docker/config.json ~/.docker/ + +# Other files as needed +``` + +#### Step 4: Cleanup +```bash +rm -rf ~/restore_temp +rm all_secrets_TIMESTAMP.tar.gz +``` + +## Security Notes + +- This backup contains ALL your private keys and secrets +- Keep it in multiple secure locations +- Test restore process periodically +- Never store unencrypted - always use GPG encryption + +Created: $(date) +System: $(sw_vers -productVersion) +EOF + +# Cleanup +rm -rf "$TEMP_DIR" + +echo -e "${GREEN}βœ… Complete encrypted backup created!${NC}" +echo "" +echo -e "${GREEN}πŸ“ Location: $BACKUP_DIR/complete/all_secrets_${TIMESTAMP}.tar.gz.gpg${NC}" +echo -e "${GREEN}πŸ“‹ Instructions: $BACKUP_DIR/complete/RESTORE_INSTRUCTIONS.md${NC}" +echo "" +echo -e "${YELLOW}πŸ’‘ This replaces all individual backups - one encrypted container for everything!${NC}" \ No newline at end of file diff --git a/scripts/backup-private-keys.sh b/scripts/backup-private-keys.sh new file mode 100755 index 0000000..1742e5a --- /dev/null +++ b/scripts/backup-private-keys.sh @@ -0,0 +1,170 @@ +#!/usr/bin/env bash +# Backup all private keys and sensitive configurations +# Following prime directive: durable, thoughtful backup strategy + +set -euo pipefail + +BACKUP_DIR="$HOME/dotfiles/backups" +TIMESTAMP=$(date +%Y%m%d_%H%M%S) + +# Colors +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' + +echo -e "${YELLOW}πŸ” Creating encrypted backup of private keys and secrets${NC}" +echo "Timestamp: $TIMESTAMP" +echo "" + +# Create backup directory +mkdir -p "$BACKUP_DIR"/{ssh,gpg,docker} + +# Function to create encrypted backup +create_encrypted_backup() { + local source_dir="$1" + local backup_name="$2" + local backup_path="$BACKUP_DIR/$backup_name" + + if [[ -d "$source_dir" ]] || [[ -f "$source_dir" ]]; then + echo -e "${YELLOW}Backing up: $source_dir${NC}" + + # Create tar archive and encrypt in one step + tar -czf - -C "$(dirname "$source_dir")" "$(basename "$source_dir")" | \ + gpg --symmetric --cipher-algo AES256 --compress-algo 2 \ + --output "${backup_path}/${backup_name}_${TIMESTAMP}.tar.gz.gpg" + + # Create restore instructions + cat > "${backup_path}/RESTORE_INSTRUCTIONS.md" << EOF +# ${backup_name^} Restore Instructions + +## Decrypting and Restoring ${backup_name^} + +To restore from backup: \`${backup_name}_${TIMESTAMP}.tar.gz.gpg\` + +### Step 1: Decrypt the backup +\`\`\`bash +gpg --decrypt ${backup_name}_${TIMESTAMP}.tar.gz.gpg > ${backup_name}_${TIMESTAMP}.tar.gz +\`\`\` + +### Step 2: Extract the archive +\`\`\`bash +tar -xzf ${backup_name}_${TIMESTAMP}.tar.gz -C ~/ +\`\`\` + +### Step 3: Set correct permissions +\`\`\`bash +chmod 700 ~/$(basename "$source_dir") +find ~/$(basename "$source_dir") -type f -exec chmod 600 {} \; +\`\`\` + +## Security Notes + +- Keep this encrypted backup secure +- Contains private keys/sensitive data +- Test restore process periodically + +## Backup Contents + +This backup includes: $(basename "$source_dir") + +Created: $(date) +System: $(sw_vers -productVersion) +EOF + + echo -e "${GREEN}βœ… Backup created: ${backup_path}/${backup_name}_${TIMESTAMP}.tar.gz.gpg${NC}" + else + echo -e "${RED}⚠️ Source not found: $source_dir${NC}" + fi +} + +# Backup GPG private keys and keyring +if [[ -d "$HOME/.gnupg" ]]; then + echo -e "${YELLOW}πŸ”‘ Backing up GPG private keys and keyring...${NC}" + + # Create temporary directory with essential GPG files + temp_gpg=$(mktemp -d) + mkdir -p "$temp_gpg/.gnupg" + + # Copy essential GPG files (not temporary/socket files) + cp -r "$HOME/.gnupg/private-keys-v1.d" "$temp_gpg/.gnupg/" 2>/dev/null || true + cp "$HOME/.gnupg/pubring.kbx" "$temp_gpg/.gnupg/" 2>/dev/null || true + cp "$HOME/.gnupg/trustdb.gpg" "$temp_gpg/.gnupg/" 2>/dev/null || true + cp "$HOME/.gnupg/gpg.conf" "$temp_gpg/.gnupg/" 2>/dev/null || true + cp "$HOME/.gnupg/gpg-agent.conf" "$temp_gpg/.gnupg/" 2>/dev/null || true + cp "$HOME/.gnupg/dirmngr.conf" "$temp_gpg/.gnupg/" 2>/dev/null || true + + # Create encrypted backup + tar -czf - -C "$temp_gpg" .gnupg | \ + gpg --symmetric --cipher-algo AES256 --compress-algo 2 \ + --output "$BACKUP_DIR/gpg/gpg_keyring_${TIMESTAMP}.tar.gz.gpg" + + # Cleanup + rm -rf "$temp_gpg" + + # Create restore instructions + cat > "$BACKUP_DIR/gpg/RESTORE_INSTRUCTIONS.md" << 'EOF' +# GPG Keyring Restore Instructions + +## Decrypting and Restoring GPG Keys + +To restore from backup: `gpg_keyring_TIMESTAMP.tar.gz.gpg` + +### Step 1: Decrypt the backup +```bash +gpg --decrypt gpg_keyring_TIMESTAMP.tar.gz.gpg > gpg_keyring_TIMESTAMP.tar.gz +``` + +### Step 2: Extract to home directory +```bash +tar -xzf gpg_keyring_TIMESTAMP.tar.gz -C ~/ +``` + +### Step 3: Set correct permissions +```bash +chmod 700 ~/.gnupg +chmod 600 ~/.gnupg/* +chmod 700 ~/.gnupg/private-keys-v1.d +chmod 600 ~/.gnupg/private-keys-v1.d/* +``` + +### Step 4: Restart GPG agent +```bash +gpgconf --kill gpg-agent +gpg --list-secret-keys # This will restart the agent +``` + +## Security Notes + +- Contains your GPG private keys - highly sensitive +- Keep encrypted backup in secure location +- Test restore process periodically + +## What's Included + +- Private keys (private-keys-v1.d/) +- Public keyring (pubring.kbx) +- Trust database (trustdb.gpg) +- GPG configuration files + +Created: $(date) +System: $(sw_vers -productVersion) +EOF + + echo -e "${GREEN}βœ… GPG keyring backup created${NC}" +fi + +# Backup Docker configuration +if [[ -f "$HOME/.docker/config.json" ]]; then + create_encrypted_backup "$HOME/.docker" "docker" +fi + +# Summary +echo "" +echo -e "${GREEN}πŸŽ‰ Backup Summary:${NC}" +echo "πŸ“ Backups stored in: $BACKUP_DIR" +echo "πŸ” All backups are GPG encrypted with AES256" +echo "πŸ“‹ Each backup includes restore instructions" +echo "" +echo -e "${YELLOW}πŸ’‘ Recommended: Store a copy of these backups in a separate secure location${NC}" +echo -e "${YELLOW}πŸ“‹ Test restore process periodically to ensure backups work${NC}" \ No newline at end of file diff --git a/scripts/diagnose-shell.sh b/scripts/diagnose-shell.sh new file mode 100755 index 0000000..99471fd --- /dev/null +++ b/scripts/diagnose-shell.sh @@ -0,0 +1,48 @@ +#!/usr/bin/env bash +# Shell configuration diagnostic tool +# Following the prime directive: understand before fixing + +set -euo pipefail + +echo "πŸ” Shell Configuration Diagnostic" +echo "==================================" + +echo "1. Current shell: $SHELL" +echo "2. Zsh version: $(zsh --version)" +echo "" + +echo "3. Checking for conflicting aliases:" +alias | grep -E "(cd=|chamber=)" || echo " No cd/chamber aliases found" +echo "" + +echo "4. Testing functions.zsh syntax:" +if zsh -n ~/dotfiles/shell/functions.zsh; then + echo " βœ… Syntax is valid" +else + echo " ❌ Syntax error found" +fi +echo "" + +echo "5. Testing incremental loading:" +echo " Loading environment.zsh..." +source ~/dotfiles/shell/environment.zsh && echo " βœ… OK" || echo " ❌ FAILED" + +echo " Loading paths.zsh..." +source ~/dotfiles/shell/paths.zsh && echo " βœ… OK" || echo " ❌ FAILED" + +echo " Loading functions.zsh..." +if source ~/dotfiles/shell/functions.zsh 2>&1 | head -1; then + echo " βœ… OK" +else + echo " ❌ FAILED - this is where the issue occurs" +fi + +echo "" +echo "6. Checking for hidden characters around line 311:" +sed -n '310,312p' ~/dotfiles/shell/functions.zsh | cat -A + +echo "" +echo "🎯 Recommended next steps:" +echo " - If syntax is clean, the issue is environmental" +echo " - Check what aliases exist before functions.zsh loads" +echo " - Consider isolation: load functions in clean shell" \ No newline at end of file diff --git a/scripts/safe-shell-reload.sh b/scripts/safe-shell-reload.sh new file mode 100755 index 0000000..5062cbd --- /dev/null +++ b/scripts/safe-shell-reload.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env zsh +# Safe shell configuration reload with conflict resolution +# Embodies μέτρον: thoughtful, measured approach to shell management + +set -euo pipefail + +DOTFILES_DIR="$HOME/dotfiles" + +# Colors +GREEN='\033[0;32m' +YELLOW='\033[1;33m' +RED='\033[0;31m' +NC='\033[0m' + +echo -e "${YELLOW}πŸ”§ Safe Shell Configuration Reload${NC}" +echo "Following prime directive: durable solutions over expedient fixes" +echo "" + +# Step 1: Clear conflicting aliases +echo "1️⃣ Clearing potential conflicts..." +unalias cd chamber 2>/dev/null || true +echo " βœ… Aliases cleared" + +# Step 2: Load in proper order with error handling +echo "2️⃣ Loading configuration modules..." + +# Environment first (sets foundation) +if source "$DOTFILES_DIR/shell/environment.zsh" 2>/dev/null; then + echo " βœ… Environment loaded" +else + echo -e " ${RED}❌ Environment failed${NC}" + exit 1 +fi + +# Paths second (builds PATH properly) +if source "$DOTFILES_DIR/shell/paths.zsh" 2>/dev/null; then + echo " βœ… Paths loaded" +else + echo -e " ${RED}❌ Paths failed${NC}" + exit 1 +fi + +# Functions third (defines utilities) +if source "$DOTFILES_DIR/shell/functions.zsh" 2>/dev/null; then + echo " βœ… Functions loaded" +else + echo -e " ${RED}❌ Functions failed - attempting repair${NC}" + + # Attempt repair: comment out problematic functions + echo " πŸ”§ Attempting automatic repair..." + + # Create backup + cp "$DOTFILES_DIR/shell/functions.zsh" "$DOTFILES_DIR/shell/functions.zsh.backup.$(date +%Y%m%d_%H%M%S)" + + # Temporarily disable chamber function + sed -i.tmp 's/^chamber()/# chamber() # DISABLED/' "$DOTFILES_DIR/shell/functions.zsh" + + if source "$DOTFILES_DIR/shell/functions.zsh" 2>/dev/null; then + echo " βœ… Functions loaded (chamber disabled)" + echo " πŸ“ Chamber function disabled - investigate separately" + else + echo -e " ${RED}❌ Functions still failing${NC}" + # Restore backup + mv "$DOTFILES_DIR/shell/functions.zsh.backup.$(date +%Y%m%d_%H%M%S)" "$DOTFILES_DIR/shell/functions.zsh" + exit 1 + fi +fi + +# Aliases last (safe to override) +if source "$DOTFILES_DIR/shell/aliases.zsh" 2>/dev/null; then + echo " βœ… Aliases loaded" +else + echo -e " ${YELLOW}⚠️ Aliases had issues - continuing${NC}" +fi + +echo "" +echo -e "${GREEN}βœ… Shell configuration successfully reloaded${NC}" +echo "🎯 Test your sysupdate function now" + +# Test critical functions +echo "" +echo "3️⃣ Testing critical functions..." +if declare -f sysupdate >/dev/null; then + echo " βœ… sysupdate function available" +else + echo -e " ${RED}❌ sysupdate not found${NC}" +fi + +if declare -f detect_context >/dev/null; then + echo " βœ… detect_context function available" +else + echo -e " ${YELLOW}⚠️ detect_context not found${NC}" +fi \ No newline at end of file diff --git a/scripts/symlinks.sh b/scripts/symlinks.sh index 8f019d2..736e8db 100755 --- a/scripts/symlinks.sh +++ b/scripts/symlinks.sh @@ -53,13 +53,25 @@ link_file "$DOTFILES_DIR/.npmrc" "$HOME/.npmrc" # Link plugin manifest link_file "$DOTFILES_DIR/shell/.zsh-plugins.txt" "$HOME/.zsh-plugins.txt" -# SSH config (template only - user must customize) -if [ -f "$DOTFILES_DIR/ssh/config.example" ] && [ ! -f "$HOME/.ssh/config" ]; then - echo -e "${YELLOW}Creating SSH config from template...${NC}" +# SSH config +echo -e "${YELLOW}Setting up SSH configuration...${NC}" +if [ -f "$DOTFILES_DIR/ssh/config" ]; then mkdir -p "$HOME/.ssh" - cp "$DOTFILES_DIR/ssh/config.example" "$HOME/.ssh/config" + link_file "$DOTFILES_DIR/ssh/config" "$HOME/.ssh/config" chmod 600 "$HOME/.ssh/config" - echo -e "${YELLOW}⚠ Edit ~/.ssh/config with your actual values${NC}" +fi + +# GPG configuration +echo -e "${YELLOW}Setting up GPG configuration...${NC}" +if [ -d "$DOTFILES_DIR/gnupg" ]; then + mkdir -p "$HOME/.gnupg" + chmod 700 "$HOME/.gnupg" + for gpg_file in gpg.conf gpg-agent.conf dirmngr.conf; do + if [ -f "$DOTFILES_DIR/gnupg/$gpg_file" ]; then + link_file "$DOTFILES_DIR/gnupg/$gpg_file" "$HOME/.gnupg/$gpg_file" + chmod 600 "$HOME/.gnupg/$gpg_file" + fi + done fi # Config directories @@ -67,7 +79,7 @@ echo -e "${YELLOW}Linking config directories...${NC}" mkdir -p "$HOME/.config" # Link config subdirectories if they exist -for config_dir in git iterm2 kitty karabiner; do +for config_dir in git iterm2 kitty karabiner neofetch swiftbar; do if [ -d "$DOTFILES_DIR/config/$config_dir" ]; then link_file "$DOTFILES_DIR/config/$config_dir" "$HOME/.config/$config_dir" fi diff --git a/shell/.zsh_plugins.txt b/shell/.zsh_plugins.txt new file mode 100644 index 0000000..54c2bcd --- /dev/null +++ b/shell/.zsh_plugins.txt @@ -0,0 +1,19 @@ +# Core enhancements +romkatv/powerlevel10k +zsh-users/zsh-completions +zsh-users/zsh-autosuggestions +zsh-users/zsh-syntax-highlighting + +# Useful navigation & productivity +rupa/z # Jump around directories +djui/alias-tips # Show hints when alias could be used +chisui/zsh-nix-shell # If using Nix at some point + +# Git integration +olivierverdier/zsh-git-prompt # Lightweight git aliases/completions + +# FZF integration (optional, only if you use fzf) +unixorn/fzf-zsh-plugin + +# Completions (optional, only if you reinstall these tools) +# mullvad/mullvad-zsh-completions diff --git a/shell/aliases-merged.zsh b/shell/aliases-merged.zsh new file mode 100644 index 0000000..7f800d5 --- /dev/null +++ b/shell/aliases-merged.zsh @@ -0,0 +1,94 @@ +# β–‘β–ˆβ–€β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–€β–ˆβ–€β–‘β–ˆβ–€β–ˆβ–‘β–ˆβ–€β–€β–‘β–ˆβ–€β–€β–‘β–ˆβ–€β–€ +# β–‘β–ˆβ–€β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–ˆβ–€β–ˆβ–‘β–€β–€β–ˆβ–‘β–ˆβ–€β–€β–‘β–€β–€β–ˆ +# β–‘β–€β–‘β–€β–‘β–€β–€β–€β–‘β–€β–€β–€β–‘β–€β–‘β–€β–‘β–€β–€β–€β–‘β–€β–€β–€β–‘β–€β–€β–€ + + +alias gs='git status' +alias kaicd='cd ~/Vault/08. Notes/Children/Kai' + +## II. File checksum verification ## +alias verify1='openssl sha1' +alias verify256='openssl dgst -sha256' + +## III. Easier navigation: .., ..., ...., and ..... +alias ..="cd .." +alias ...="cd ../.." +alias ....="cd ../../.." +alias .....="cd ../../../.." + +## IV. Shortcuts +alias dl="cd ~/Downloads" +alias dt="cd ~/Desktop" +alias docs="cd ~/Documents" + +# use eza +alias ls='eza --color=auto --group-directories-first --icons' +alias ll='eza -lgh --git' +alias la='eza -la --git' +alias lt='eza --tree' + +# use coreutils ls +# alias ls='gls --color=auto' +# List all files in long format +# alias l="gls -lF --color=auto" +# List all files in long format, excluding . and .. +# alias la="gls -lAF --color=auto" +# List only directories +# alias lsd="gls -lF | grep --color=never '^d'" +# alias ll='gls -lah --color=aut' + +# view man pages with bat (replaced by enhanced man function in functions.zsh) +# alias batman='man -P "bat -l man -p"' + +# Get macOS Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages +alias update="read -q 'REPLY?Run full system update? (y/n) ' && echo && sysupdate || echo 'Aborted.'" +# Maintenance scripts +alias mrclean='sudo periodic daily weekly monthly' +# Download using cURL +alias dl="curl -O" +# yt-dlp at best quility and in .mp4 format +alias yt="yt-dlp -S res,ext:mp4:m4a --recode mp4" +# Internet speed test with Cloudfare CLI +alias speed="npx speed-cloudflare-cli" +# IP addresses +alias ip="dig +short myip.opendns.com @resolver1.opendns.com" +alias localip="ipconfig getifaddr en0" +alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" +# Clean up LaunchServices to remove duplicates in the β€œOpen With” menu +alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" +# Recursively delete `.DS_Store` files +alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" +# Empty the Trash on all mounted volumes and the main HDD. +# Also, clear Apple’s System Logs to improve shell startup speed. +# Finally, clear download history from quarantine. https://mths.be/bum +alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'" +# Show/hide hidden files in Finder +alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" +alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" +# Disable Spotlight +alias spotoff="sudo mdutil -a -i off" +# Enable Spotlight +alias spoton="sudo mdutil -a -i on" +# Lock the screen (when going AFK) +alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" +# Access quicklook from terminal +alias ql="qlmanage -p " +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh + +## Animal Rationis Capax +# work session +alias arc="cd /Users/davidglidden/Documents/GitHub/davidglidden.github.io && claude 'Context initialization: +Please read these files in order: +1. CLAUDE.md - Project instructions and workflow triggers +2. docs/internal/collaboration-protocol.md - Our working relationship +3. docs/internal/project-memory.md - Complete development history +4. docs/chamber/workflow/MODE-1-UNIFIED.md - Current Chamber operations +5. docs/style-guide.md - Editorial guidelines and notation system + +After reading, confirm you understand the current state and are ready for today'\''s work.'" + +# glimpse processing +alias glimpse='cd ~/animal-davidglidden-eu/tools/glimpse-processing && source venv/bin/activate && python glimpse_tool.py' + +## Tetris +alias tetris='/opt/homebrew/opt/vitetris/bin/tetris' diff --git a/shell/aliases.zsh b/shell/aliases.zsh index 0ab4a2d..f893930 100644 --- a/shell/aliases.zsh +++ b/shell/aliases.zsh @@ -2,155 +2,82 @@ # β–‘β–ˆβ–€β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–ˆβ–€β–ˆβ–‘β–€β–€β–ˆβ–‘β–ˆβ–€β–€β–‘β–€β–€β–ˆ # β–‘β–€β–‘β–€β–‘β–€β–€β–€β–‘β–€β–€β–€β–‘β–€β–‘β–€β–‘β–€β–€β–€β–‘β–€β–€β–€β–‘β–€β–€β–€ -# Enhanced aliases with intelligent fallbacks and context awareness -# ═══════════════════════════════════════════════════════════════════════════════ -# I. NAVIGATION & LISTING -# ═══════════════════════════════════════════════════════════════════════════════ +alias gs='git status' +alias kaicd='cd ~/Vault/08. Notes/Children/Kai' -# Enhanced navigation with consistent patterns +## II. File checksum verification ## +alias verify1='openssl sha1' +alias verify256='openssl dgst -sha256' + +## III. Easier navigation: .., ..., ...., and ..... alias ..="cd .." alias ...="cd ../.." alias ....="cd ../../.." alias .....="cd ../../../.." -alias -- -="cd -" # Go back to previous directory -# Context-aware directory shortcuts +## IV. Shortcuts alias dl="cd ~/Downloads" alias dt="cd ~/Desktop" alias docs="cd ~/Documents" -alias vault="cd '$VAULT_PATH'" -alias chamber="cd '$CHAMBER_PATH'" -alias work="cd '$WORK_PATH'" -alias dotfiles="cd '$DOTFILES_PATH'" -# Vault-specific navigation -alias daily="cd '$VAULT_PATH/01. Daily'" -alias notes="cd '$VAULT_PATH/08. Notes'" -alias projects="cd '$VAULT_PATH/06. Projects'" -alias templates="cd '$VAULT_PATH/98. Templates'" +# use eza +alias ls='eza --color=auto --group-directories-first --icons' +alias ll='eza -lgh --git' +alias la='eza -la --git' +alias lt='eza --tree' -# Enhanced listing with eza (fallback to ls) -if command -v eza >/dev/null 2>&1; then - alias ls='eza --color=auto --group-directories-first --icons' - alias ll='eza -lgh --git --time-style=relative' - alias la='eza -la --git --time-style=relative' - alias lt='eza --tree --level=2 --icons --git' - alias ltree='eza --tree --icons --git' - alias lx='eza -lgh --sort=extension --git' - alias lk='eza -lgh --sort=size --git' - alias lt='eza -lgh --sort=modified --git' -else - # Fallback to standard ls with colors - alias ls='ls --color=auto' - alias ll='ls -lh' - alias la='ls -lah' - alias lt='ls -lt' -fi +# use coreutils ls +# alias ls='gls --color=auto' +# List all files in long format +# alias l="gls -lF --color=auto" +# List all files in long format, excluding . and .. +# alias la="gls -lAF --color=auto" +# List only directories +# alias lsd="gls -lF | grep --color=never '^d'" +# alias ll='gls -lah --color=aut' -# ═══════════════════════════════════════════════════════════════════════════════ -# II. GIT & VERSION CONTROL -# ═══════════════════════════════════════════════════════════════════════════════ +# view man pages with bat (replaced by enhanced man function in functions.zsh) +# alias batman='man -P "bat -l man -p"' -alias gs='git status' -alias ga='git add' -alias gc='git commit' -alias gp='git push' -alias gl='git pull' -alias gd='git diff' -alias gb='git branch' -alias gco='git checkout' -alias glog='git log --oneline --graph --decorate' - -# Enhanced git aliases -alias gss='git status --short' -alias gaa='git add --all' -alias gcm='git commit -m' -alias gcam='git commit -am' -alias gundo='git reset --soft HEAD~1' -alias gclean='git clean -fd' - -# ═══════════════════════════════════════════════════════════════════════════════ -# III. SEARCH & TEXT PROCESSING -# ═══════════════════════════════════════════════════════════════════════════════ - -# Enhanced search with ripgrep (fallback to grep) -if command -v rg >/dev/null 2>&1; then - alias grep='rg --smart-case --follow --color=always' - alias greph='rg --hidden --follow --color=always' - alias grepi='rg --ignore-case --follow --color=always' -else - alias grep='grep --color=auto' - alias grepi='grep -i --color=auto' -fi - -# Enhanced cat with bat (fallback to cat) -if command -v bat >/dev/null 2>&1; then - alias cat='bat --style=auto' - alias ccat='bat --style=plain' # Plain cat equivalent -else - alias bat='cat' -fi - -# ═══════════════════════════════════════════════════════════════════════════════ -# IV. MEDIA & DOWNLOADS -# ═══════════════════════════════════════════════════════════════════════════════ - -# Download utilities +# Get macOS Software Updates, and update installed Ruby gems, Homebrew, npm, and their installed packages +alias update="read -q 'REPLY?Run full system update? (y/n) ' && echo && sysupdate || echo 'Aborted.'" +# Maintenance scripts +alias mrclean='sudo periodic daily weekly monthly' +# Download using cURL alias dl="curl -O" +# yt-dlp at best quility and in .mp4 format alias yt="yt-dlp -S res,ext:mp4:m4a --recode mp4" -alias yta="yt-dlp -x --audio-format mp3" - -# Quick media info -alias mediainfo='ffprobe -v quiet -print_format json -show_format -show_streams' - -# ═══════════════════════════════════════════════════════════════════════════════ -# V. SYSTEM MONITORING & NETWORK -# ═══════════════════════════════════════════════════════════════════════════════ - -# Network information +# Internet speed test with Cloudfare CLI +alias speed="npx speed-cloudflare-cli" +# IP addresses alias ip="dig +short myip.opendns.com @resolver1.opendns.com" alias localip="ipconfig getifaddr en0" alias ips="ifconfig -a | grep -o 'inet6\? \(addr:\)\?\s\?\(\(\([0-9]\+\.\)\{3\}[0-9]\+\)\|[a-fA-F0-9:]\+\)' | awk '{ sub(/inet6? (addr:)? ?/, \"\"); print }'" - -# Speed and connectivity -alias speed="npx speed-cloudflare-cli" -alias ping="ping -c 5" -alias pingg="ping google.com" - -# System monitoring -alias cpu="top -F -R -o cpu" -alias mem="top -F -R -o rsize" -alias ports="lsof -i -P | grep LISTEN" - -# ═══════════════════════════════════════════════════════════════════════════════ -# VI. MACOS SPECIFIC -# ═══════════════════════════════════════════════════════════════════════════════ - -# Finder and system +# Clean up LaunchServices to remove duplicates in the β€œOpen With” menu +alias lscleanup="/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user && killall Finder" +# Recursively delete `.DS_Store` files +alias cleanup="find . -type f -name '*.DS_Store' -ls -delete" +# Empty the Trash on all mounted volumes and the main HDD. +# Also, clear Apple’s System Logs to improve shell startup speed. +# Finally, clear download history from quarantine. https://mths.be/bum +alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl; sqlite3 ~/Library/Preferences/com.apple.LaunchServices.QuarantineEventsV* 'delete from LSQuarantineEvent'" +# Show/hide hidden files in Finder alias show="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder" alias hide="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder" -alias ql="qlmanage -p" # Quick Look from terminal -alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" - -# Spotlight control +# Disable Spotlight alias spotoff="sudo mdutil -a -i off" +# Enable Spotlight alias spoton="sudo mdutil -a -i on" +# Lock the screen (when going AFK) +alias afk="/System/Library/CoreServices/Menu\ Extras/User.menu/Contents/Resources/CGSession -suspend" +# Access quicklook from terminal +alias ql="qlmanage -p " +[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh -# ═══════════════════════════════════════════════════════════════════════════════ -# VII. CHECKSUMS & SECURITY -# ═══════════════════════════════════════════════════════════════════════════════ - -alias verify1='openssl sha1' -alias verify256='openssl dgst -sha256' -alias verify512='openssl dgst -sha512' - -# ═══════════════════════════════════════════════════════════════════════════════ -# VIII. WORKFLOW SPECIFIC -# ═══════════════════════════════════════════════════════════════════════════════ - -# Work context (Animal Rationis Capax) -alias arc="cd '$WORK_PATH' && claude 'Context initialization: +## Animal Rationis Capax +# work session +alias arc="cd /Users/davidglidden/Documents/GitHub/davidglidden.github.io && claude 'Context initialization: Please read these files in order: 1. CLAUDE.md - Project instructions and workflow triggers 2. docs/internal/collaboration-protocol.md - Our working relationship @@ -160,38 +87,12 @@ Please read these files in order: After reading, confirm you understand the current state and are ready for today'\''s work.'" -# Glimpse processing -alias glimpse="cd '$CHAMBER_PATH/tools/glimpse-processing' && source venv/bin/activate && python glimpse_tool.py" +# glimpse processing +alias glimpse='cd ~/animal-davidglidden-eu/tools/glimpse-processing && source venv/bin/activate && python glimpse_tool.py' -# Entertainment +## Tetris alias tetris='/opt/homebrew/opt/vitetris/bin/tetris' -# ═══════════════════════════════════════════════════════════════════════════════ -# IX. MAINTENANCE & UPDATES -# ═══════════════════════════════════════════════════════════════════════════════ - -# System maintenance (interactive confirmation) -alias update="read -q 'REPLY?Run full system update? (y/n) ' && echo && sysupdate || echo 'Aborted.'" -alias mrclean='sudo periodic daily weekly monthly' - -# Comprehensive cleanup -alias cleanup='deep_clean' # References function in functions.zsh - -# Quick dotfiles management -alias dotfiles-backup='$DOTFILES_PATH/bin/backup-dotfiles' -alias dotfiles-status='$DOTFILES_PATH/bin/check-app-configs' - -# ═══════════════════════════════════════════════════════════════════════════════ -# X. DOTFILES SYSTEM TOOLS -# ═══════════════════════════════════════════════════════════════════════════════ - -# Health monitoring and maintenance -alias health='~/dotfiles/scripts/system-health.sh' -alias drift='~/dotfiles/scripts/detect-drift.sh' -alias lockfile='~/dotfiles/scripts/generate-lockfile.sh' -alias safe-update='~/dotfiles/scripts/safe-update.sh' - -# Quick health checks -alias health-monitor='~/dotfiles/scripts/system-health.sh monitor' -alias health-json='~/dotfiles/scripts/system-health.sh json' -alias drift-quiet='~/dotfiles/scripts/detect-drift.sh --quiet' \ No newline at end of file +## Pass license management shortcuts +alias licenses='pass ls licenses/' +alias license='pass show licenses/' diff --git a/shell/environment.zsh b/shell/environment.zsh index edb4f22..9ecc681 100644 --- a/shell/environment.zsh +++ b/shell/environment.zsh @@ -5,8 +5,8 @@ # Core environment variables with graceful fallbacks # πŸ–‹ Preferred editors -export EDITOR="${EDITOR:-bbedit}" -export VISUAL="${VISUAL:-bbedit}" +export EDITOR="bbedit -w" +export VISUAL="bbedit -w" # 🌍 Locale settings export LANG="${LANG:-en_US.UTF-8}" diff --git a/shell/functions-merged.zsh b/shell/functions-merged.zsh new file mode 100644 index 0000000..655ebc2 --- /dev/null +++ b/shell/functions-merged.zsh @@ -0,0 +1,228 @@ +# β–‘β–ˆβ–€β–€β–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–€β–ˆβ–‘β–ˆβ–€β–€β–‘β–€β–ˆβ–€β–‘β–€β–ˆβ–€β–‘β–ˆβ–€β–ˆβ–‘β–ˆβ–€β–ˆβ–‘β–ˆβ–€β–€ +# β–‘β–ˆβ–€β–€β–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–ˆβ–‘β–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–‘β–€β–€β–ˆ +# β–‘β–€β–‘β–‘β–‘β–€β–€β–€β–‘β–€β–‘β–€β–‘β–€β–€β–€β–‘β–‘β–€β–‘β–‘β–€β–€β–€β–‘β–€β–€β–€β–‘β–€β–‘β–€β–‘β–€β–€β–€ + +## I. PDF Compression ####################### +pdfcompress () +{ + gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dPDFSETTINGS=/screen -dEmbedAllFonts=true -dSubsetFonts=true -dColorImageDownsampleType=/Bicubic -dColorImageResolution=144 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=144 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=144 -sOutputFile=$1.compressed.pdf $1; +} + +## II. Weather ####################### + +wttr() { + # Usage: wttr [location] + # Examples: wttr -> your IP-based location + # wttr 75012 -> Paris 12e + # wttr 23190 -> Crozant + local location=${1:-} + curl -s "wttr.in/${location}?n" +} + +## III. Updates (system, brew, etc) ####################### +## Description: Performs system updates, Homebrew cleanup, fzf refresh, moon phase logging, and dotfile sync ########################### + +function sysupdate() { + local start_time=$(date +%s) + echo "πŸ”§ Starting full system update at $(date)" + + # Ensure sudo credentials are fresh + if ! sudo -vn 2>/dev/null; then + echo "πŸ”’ sudo authentication required..." + sudo -v + fi + + echo "🍎 Updating macOS Software..." + sudo softwareupdate -i -a + + echo "🍺 Updating Homebrew packages..." + brew update + brew upgrade + brew cleanup + brew autoremove + + # Mac App Store updates + echo "🍎 Updating Mac App Store apps..." + if command -v mas >/dev/null; then + local mas_outdated=$(mas outdated) + if [[ -n "$mas_outdated" ]]; then + echo "πŸ“± Updating MAS apps:" + echo "$mas_outdated" | while read -r line; do + echo " $line" + done + mas upgrade || echo "⚠️ Some MAS updates may require manual intervention" + else + echo "βœ… All MAS apps are up to date" + fi + else + echo "⚠️ mas not installed - install with: brew install mas" + fi + + echo "πŸ”„ Refreshing fzf..." + if [ -d ~/.fzf ]; then + cd ~/.fzf && git pull && ./install --all && cd - + fi + + # Fix Zsh completion security warnings + echo "πŸ”’ Checking Zsh completion security..." + if [[ -d "/opt/homebrew/share/zsh" ]]; then + # Fix common Homebrew Zsh permission issues + chmod 755 /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions 2>/dev/null || true + fi + + echo "🧹 Checking for broken symlinks..." + find /usr/local/bin "$HOME/bin" "$HOME/.local/bin" -xtype l 2>/dev/null + + echo "πŸŒ“ Moon phase at update time:" + if command -v curl &>/dev/null && command -v jq >/dev/null; then + # Use API key from SwiftBar script + local api_key="6ec71a8170214d828c08ba8bf2ca29e9" + moon_json=$(curl -s "https://api.ipgeolocation.io/astronomy?apiKey=$api_key" 2>/dev/null) + if [[ $? -eq 0 ]] && [[ -n "$moon_json" ]]; then + moon_phase=$(echo "$moon_json" | jq -r '.moon_phase // "Unknown"' | tr '_' ' ') + illum=$(echo "$moon_json" | jq -r '.moon_illumination_percentage // "Unknown"') + # Add moon emoji based on phase + local moon_emoji="πŸŒ™" + case "$moon_phase" in + "new moon") moon_emoji="πŸŒ‘" ;; + "waxing crescent") moon_emoji="πŸŒ’" ;; + "first quarter") moon_emoji="πŸŒ“" ;; + "waxing gibbous") moon_emoji="πŸŒ”" ;; + "full moon") moon_emoji="πŸŒ•" ;; + "waning gibbous") moon_emoji="πŸŒ–" ;; + "last quarter") moon_emoji="πŸŒ—" ;; + "waning crescent") moon_emoji="🌘" ;; + esac + echo "$moon_emoji $moon_phase (${illum}%)" + else + echo "πŸŒ™ Moon phase unavailable" + fi + else + echo "πŸŒ™ Moon phase tracking disabled (missing curl or jq)" + fi + + if [ -d "$HOME/.dotfiles" ]; then + echo "πŸ“ Committing dotfile changes..." + cd ~/.dotfiles || return + git add . && git commit -m "πŸ”§ Auto-commit from sysupdate on $(date '+%Y-%m-%d %H:%M')" && git push + brew bundle dump --force --file="$HOME/.dotfiles/Brewfile" + cd - >/dev/null || return + fi + + echo "πŸ“Š System Info:" + echo "πŸ’» $(uname -a)" + echo "πŸ“… macOS: $(sw_vers | grep ProductVersion)" + echo "🧠 Memory: $(top -l 1 -s 0 | grep PhysMem)" + + # Optional post-update hook + if [ -x "$HOME/.zsh/hooks/post-update" ]; then + "$HOME/.zsh/hooks/post-update" + fi + + echo "πŸ•“ Duration: $(($(date +%s) - $start_time))s" + osascript -e 'display notification "Update complete!" with title "System Maintenance" subtitle "All systems go πŸš€"' +} + +# πŸ’€ Quiet version (no output, same functionality) +function quietupdate() { + local start_time=$(date +%s) + sudo -vn 2>/dev/null || sudo -v + sudo softwareupdate -i -a >/dev/null + brew update >/dev/null && brew upgrade >/dev/null && brew cleanup >/dev/null && brew autoremove >/dev/null + [ -d ~/.fzf ] && cd ~/.fzf && git pull >/dev/null && ./install --all >/dev/null && cd - >/dev/null + [ -d "$HOME/.dotfiles" ] && cd ~/.dotfiles && git add . && git commit -m "auto sysupdate" && git push && brew bundle dump --force --file="$HOME/.dotfiles/Brewfile" && cd - >/dev/null + if [ -x "$HOME/.zsh/hooks/post-update" ]; then "$HOME/.zsh/hooks/post-update"; fi + osascript -e 'display notification "Quiet update complete!" with title "System Maintenance"' +} + +## IV. Enhanced Man Page Viewer ####################### + +# Detect current terminal for optimal display +detect_terminal() { + if [[ -n "${KITTY_WINDOW_ID-}" ]]; then + echo "kitty" + elif [[ -n "${ITERM_SESSION_ID-}" ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + echo "iterm" + elif [[ "$TERM_PROGRAM" == "kitty" ]]; then + echo "kitty" + else + echo "unknown" + fi +} + +# Enhanced man function with beautiful formatting in new window +man() { + # If no arguments, show usage + if [[ $# -eq 0 ]]; then + echo "Usage: man [section]" + echo "Opens beautifully formatted man page in new terminal window" + return 1 + fi + + local cmd="$1" + local section="${2:-}" + local terminal_type=$(detect_terminal) + + # Check if man page exists + if ! command man -w ${section:+$section} "$cmd" >/dev/null 2>&1; then + echo "❌ No manual entry for '$cmd'${section:+ in section $section}" + return 1 + fi + + # Build the command to run in new window + local man_cmd + if command -v bat >/dev/null; then + # Use bat for beautiful syntax highlighting with Nord theme + man_cmd="MANPAGER='bat --language=man --style=grid --color=always --theme=Nord' man ${section:+$section} '$cmd'" + else + # Fallback to enhanced less + man_cmd="MANPAGER='less -R' man ${section:+$section} '$cmd'" + fi + + # Terminal-specific window creation + case "$terminal_type" in + "kitty") + # Kitty: New window with optimal size for reading + kitty @ new-window --title "πŸ“– man $cmd${section:+ ($section)}" --cwd "$PWD" \ + zsh -c "$man_cmd; echo; echo 'πŸ“– Press any key to close...'; read -k1" + ;; + "iterm") + # iTerm2: New window with AppleScript + osascript -e " + tell application \"iTerm\" + create window with default profile + tell current session of current window + write text \"$man_cmd; echo; echo 'πŸ“– Press any key to close...'; read -k1\" + set name to \"πŸ“– man $cmd${section:+ ($section)}\" + end tell + end tell + " >/dev/null 2>&1 + ;; + *) + # Fallback: run in current terminal with nice formatting + echo "πŸ“– Displaying man page for '$cmd'${section:+ (section $section)}:" + echo "" + eval "$man_cmd" + ;; + esac +} + +# Quick man page search function +mans() { + if [[ $# -eq 0 ]]; then + echo "Usage: mans " + echo "Search for man pages containing the term" + return 1 + fi + + echo "πŸ” Searching man pages for: $*" + echo "" + + # Use apropos to search, format nicely + if command -v bat >/dev/null; then + apropos "$*" | bat --language=man --style=plain --theme=Nord + else + apropos "$*" + fi +} + diff --git a/shell/functions.zsh b/shell/functions.zsh index b54758c..655ebc2 100644 --- a/shell/functions.zsh +++ b/shell/functions.zsh @@ -2,398 +2,227 @@ # β–‘β–ˆβ–€β–€β–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–‘β–‘β–‘β–‘β–ˆβ–‘β–‘β–‘β–ˆβ–‘β–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–‘β–ˆβ–‘β–€β–€β–ˆ # β–‘β–€β–‘β–‘β–‘β–€β–€β–€β–‘β–€β–‘β–€β–‘β–€β–€β–€β–‘β–‘β–€β–‘β–‘β–€β–€β–€β–‘β–€β–€β–€β–‘β–€β–‘β–€β–‘β–€β–€β–€ -# Sophisticated shell functions following durability principles - -# ═══════════════════════════════════════════════════════════════════════════════ -# I. SYSTEM MAINTENANCE & UPDATES -# ═══════════════════════════════════════════════════════════════════════════════ - -# Enhanced system update with error handling and rollback capability -sysupdate() { - local start_time=$(date +%s) - local backup_dir="$HOME/.system-snapshots/$(date +%Y%m%d_%H%M%S)" - - echo "πŸ”§ Starting comprehensive system update at $(date)" - - # Ensure sudo credentials and create backup point - if ! sudo -vn 2>/dev/null; then - echo "πŸ”’ sudo authentication required..." - sudo -v || return 1 - fi - - mkdir -p "$backup_dir" - - # Create restore point - echo "πŸ’Ύ Creating system snapshot..." - brew list > "$backup_dir/brew_before.txt" 2>/dev/null || true - cp "$HOME/.zshrc" "$backup_dir/" 2>/dev/null || true - - # macOS updates with error handling - echo "🍎 Updating macOS Software..." - if ! sudo softwareupdate -i -a; then - echo "⚠️ macOS updates had issues - check manually" - fi - - # Homebrew updates with verification - echo "🍺 Updating Homebrew packages..." - if ! (brew update && brew upgrade); then - echo "❌ Homebrew update failed. Restore point: $backup_dir" - return 1 - fi - - # Mac App Store updates - echo "🍎 Updating Mac App Store apps..." - if command -v mas >/dev/null; then - local mas_outdated=$(mas outdated) - if [[ -n "$mas_outdated" ]]; then - echo "πŸ“± Updating MAS apps:" - echo "$mas_outdated" | while read -r line; do - echo " $line" - done - mas upgrade || echo "⚠️ Some MAS updates may require manual intervention" - else - echo "βœ… All MAS apps are up to date" - fi - else - echo "⚠️ mas not installed - install with: brew install mas" - fi - - # Verify critical tools still work - local critical_tools=(git zsh python3 brew) - for tool in "${critical_tools[@]}"; do - if ! command -v "$tool" >/dev/null; then - echo "❌ Critical tool $tool missing after update!" - echo "πŸ”„ Restore point available: $backup_dir" - return 1 - fi - done - - # Safe cleanup - brew cleanup --prune=all - brew autoremove - - # Update fzf if present - echo "πŸ”„ Refreshing development tools..." - if [[ -d ~/.fzf ]]; then - (cd ~/.fzf && git pull && ./install --all) >/dev/null 2>&1 || true - fi - - # Fix Zsh completion security warnings - echo "πŸ”’ Checking Zsh completion security..." - if [[ -d "/opt/homebrew/share/zsh" ]]; then - # Fix common Homebrew Zsh permission issues - chmod 755 /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions 2>/dev/null || true - fi - - # Check for broken symlinks - echo "🧹 Checking for broken symlinks..." - local broken_links=$(find "/usr/local/bin" "$HOME/bin" "$HOME/.local/bin" -xtype l 2>/dev/null) - [[ -n "$broken_links" ]] && echo "πŸ”— Broken symlinks found:\n$broken_links" - - # Moon phase logging (using SwiftBar API key) - echo "πŸŒ“ Celestial context:" - if command -v curl >/dev/null && command -v jq >/dev/null; then - # Use API key from SwiftBar script - local api_key="6ec71a8170214d828c08ba8bf2ca29e9" - local moon_json=$(curl -s "https://api.ipgeolocation.io/astronomy?apiKey=$api_key" 2>/dev/null) - if [[ $? -eq 0 ]] && [[ -n "$moon_json" ]]; then - local moon_phase=$(echo "$moon_json" | jq -r '.moon_phase // "Unknown"' | tr '_' ' ') - local illum=$(echo "$moon_json" | jq -r '.moon_illumination_percentage // "Unknown"') - # Add moon emoji based on phase - local moon_emoji="πŸŒ™" - case "$moon_phase" in - "new moon") moon_emoji="πŸŒ‘" ;; - "waxing crescent") moon_emoji="πŸŒ’" ;; - "first quarter") moon_emoji="πŸŒ“" ;; - "waxing gibbous") moon_emoji="πŸŒ”" ;; - "full moon") moon_emoji="πŸŒ•" ;; - "waning gibbous") moon_emoji="πŸŒ–" ;; - "last quarter") moon_emoji="πŸŒ—" ;; - "waning crescent") moon_emoji="🌘" ;; - esac - echo "$moon_emoji $moon_phase (${illum}%)" - else - echo "πŸŒ™ Moon phase unavailable" - fi - else - echo "πŸŒ™ Moon phase tracking disabled (missing curl or jq)" - fi - - # Dotfiles management (corrected path) - if [[ -d "$DOTFILES_PATH" ]]; then - echo "πŸ“ Syncing dotfiles..." - ( - cd "$DOTFILES_PATH" || return - git add . - git commit -m "πŸ”§ Auto-commit from sysupdate on $(date '+%Y-%m-%d %H:%M')" 2>/dev/null || true - git push 2>/dev/null || true - brew bundle dump --force --file="$DOTFILES_PATH/Brewfile" 2>/dev/null || true - ) - fi - - # System information summary - echo "πŸ“Š System Status:" - echo "πŸ’» $(uname -a)" - echo "πŸ“… macOS: $(sw_vers -productVersion)" - echo "🧠 Memory: $(top -l 1 -s 0 | grep PhysMem | awk '{print $2 " used, " $6 " available"}')" - echo "πŸ’Ώ Disk: $(df -h / | tail -1 | awk '{print $3 " used, " $4 " available (" $5 " full)"}')" - - # Post-update hooks - if [[ -x "$HOME/.zsh/hooks/post-update" ]]; then - echo "πŸͺ Running post-update hooks..." - "$HOME/.zsh/hooks/post-update" - fi - - local duration=$(($(date +%s) - start_time)) - echo "πŸ•“ Update completed in ${duration}s" - - # Success notification - if command -v osascript >/dev/null; then - osascript -e 'display notification "All systems updated successfully! πŸš€" with title "System Maintenance Complete"' - fi - - # Cleanup old snapshots (keep last 5) - find "$HOME/.system-snapshots" -maxdepth 1 -type d -name "20*" | sort -r | tail -n +6 | xargs rm -rf 2>/dev/null || true +## I. PDF Compression ####################### +pdfcompress () +{ + gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICE=pdfwrite -dCompatibilityLevel=1.3 -dPDFSETTINGS=/screen -dEmbedAllFonts=true -dSubsetFonts=true -dColorImageDownsampleType=/Bicubic -dColorImageResolution=144 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=144 -dMonoImageDownsampleType=/Bicubic -dMonoImageResolution=144 -sOutputFile=$1.compressed.pdf $1; } -# Quiet version for automated updates -quietupdate() { - sysupdate >/dev/null 2>&1 - echo "Silent update completed at $(date)" -} +## II. Weather ####################### -# ═══════════════════════════════════════════════════════════════════════════════ -# II. COMPREHENSIVE SYSTEM CLEANING -# ═══════════════════════════════════════════════════════════════════════════════ - -deep_clean() { - echo "🧹 Initiating deep system cleaning..." - local cleaned=() - - # DS_Store cleanup - local ds_count=$(find "$HOME" -name ".DS_Store" -delete -print 2>/dev/null | wc -l) - [[ $ds_count -gt 0 ]] && cleaned+=("$ds_count .DS_Store files") - - # Broken symlinks - local broken_symlinks=$(find "$HOME/bin" "$HOME/.local/bin" -xtype l 2>/dev/null) - if [[ -n "$broken_symlinks" ]]; then - echo "$broken_symlinks" | xargs rm -f - local broken_count=$(echo "$broken_symlinks" | wc -l) - cleaned+=("$broken_count broken symlinks") - fi - - # Cache cleanup - local cache_dirs=( - "$HOME/Library/Caches/pip" - "$HOME/.npm/_cacache" - "$HOME/.cache" - "$HOME/Library/Caches/Homebrew" - ) - - for cache_dir in "${cache_dirs[@]}"; do - if [[ -d "$cache_dir" ]]; then - local cache_size=$(du -sh "$cache_dir" 2>/dev/null | cut -f1) - rm -rf "$cache_dir"/* 2>/dev/null || true - [[ -n "$cache_size" ]] && cleaned+=("$cache_size from $(basename "$cache_dir") cache") - fi - done - - # Homebrew cleanup - if command -v brew >/dev/null; then - local brew_output=$(brew cleanup --prune=all 2>&1) - [[ "$brew_output" != *"Nothing to do"* ]] && cleaned+=("Homebrew packages") - fi - - # Launch Services cleanup - echo "πŸ”„ Rebuilding Launch Services database..." - /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user 2>/dev/null || true - cleaned+=("Launch Services database") - - # Trash cleanup (with confirmation) - if [[ -n "$(ls -A ~/.Trash 2>/dev/null)" ]]; then - echo -n "πŸ—‘οΈ Empty Trash? (y/N): " - read -r response - if [[ "$response" =~ ^[Yy]$ ]]; then - rm -rf ~/.Trash/* 2>/dev/null || true - cleaned+=("Trash contents") - fi - fi - - # Summary - if [[ ${#cleaned[@]} -gt 0 ]]; then - echo "βœ… Cleaned: ${(j:, :)cleaned}" - else - echo "✨ System already clean!" - fi - - # Final system state - echo "πŸ’Ώ Free space: $(df -h / | tail -1 | awk '{print $4}')" -} - -# ═══════════════════════════════════════════════════════════════════════════════ -# III. VAULT & OBSIDIAN INTEGRATION -# ═══════════════════════════════════════════════════════════════════════════════ - -# Create or open today's daily note -today() { - if [[ ! -d "$VAULT_PATH" ]]; then - echo "❌ Vault not found at: $VAULT_PATH" - return 1 - fi - - local daily_path="$VAULT_PATH/01. Daily" - local today_file="$daily_path/$(date +%Y-%m-%d).md" - local template_file="$VAULT_PATH/98. Templates/Daily Note Template.md" - - # Create daily note from template if it doesn't exist - if [[ ! -f "$today_file" ]]; then - if [[ -f "$template_file" ]]; then - cp "$template_file" "$today_file" - echo "πŸ“ Created today's daily note" - else - echo "⚠️ Template not found, creating basic daily note" - echo "# $(date +%Y-%m-%d)\n\n## Morning\n\n## Evening\n\n" > "$today_file" - fi - fi - - # Open in Obsidian - if command -v open >/dev/null; then - open -a Obsidian "$today_file" - else - echo "πŸ“ Daily note: $today_file" - fi -} - -# Quick vault search with fzf -vf() { - if [[ ! -d "$VAULT_PATH" ]]; then - echo "❌ Vault not found" - return 1 - fi - - if ! command -v fzf >/dev/null; then - echo "❌ fzf not available" - return 1 - fi - - local file - file=$(find "$VAULT_PATH" -name "*.md" -not -path "*/.*" | \ - sed "s|$VAULT_PATH/||" | \ - fzf --preview "head -20 '$VAULT_PATH/{}'" \ - --preview-window=right:60% \ - --header="Select vault file to open") - - if [[ -n "$file" ]]; then - open -a Obsidian "$VAULT_PATH/$file" - fi -} - -# Weekly review creation -weekly() { - local week_num=$(date +%U) - local year=$(date +%Y) - local weekly_file="$VAULT_PATH/02. Reviews & Planning/${year}-W${week_num}.md" - local template_file="$VAULT_PATH/98. Templates/Weekly_Review_Template.md" - - if [[ ! -f "$weekly_file" ]] && [[ -f "$template_file" ]]; then - cp "$template_file" "$weekly_file" - echo "πŸ“… Created weekly review for week $week_num" - fi - - open -a Obsidian "$weekly_file" 2>/dev/null || echo "πŸ“ Weekly review: $weekly_file" -} - -# ═══════════════════════════════════════════════════════════════════════════════ -# IV. CHAMBER & WORKFLOW INTEGRATION -# ═══════════════════════════════════════════════════════════════════════════════ - -# Chamber mode switching -chamber() { - local mode="${1:-unified}" - local mode_file="$CHAMBER_PATH/docs/chamber/workflow/MODE-${mode^^}.md" - - if [[ -f "$mode_file" ]]; then - open "$mode_file" 2>/dev/null || echo "πŸ“ Chamber mode: $mode_file" - cd "$CHAMBER_PATH" 2>/dev/null || true - export CURRENT_CONTEXT="chamber" - else - echo "❌ Chamber mode '$mode' not found" - echo "Available modes:" - ls "$CHAMBER_PATH/docs/chamber/workflow/MODE-"*.md 2>/dev/null | \ - sed 's/.*MODE-\(.*\)\.md/\1/' | tr '[:upper:]' '[:lower:]' || echo "None found" - fi -} - -# ═══════════════════════════════════════════════════════════════════════════════ -# V. UTILITY FUNCTIONS -# ═══════════════════════════════════════════════════════════════════════════════ - -# Enhanced weather function wttr() { - local location=${1:-} - local format=${2:-"?n"} # Default to narrow format - - if command -v curl >/dev/null; then - curl -s "wttr.in/${location}${format}" + # Usage: wttr [location] + # Examples: wttr -> your IP-based location + # wttr 75012 -> Paris 12e + # wttr 23190 -> Crozant + local location=${1:-} + curl -s "wttr.in/${location}?n" +} + +## III. Updates (system, brew, etc) ####################### +## Description: Performs system updates, Homebrew cleanup, fzf refresh, moon phase logging, and dotfile sync ########################### + +function sysupdate() { + local start_time=$(date +%s) + echo "πŸ”§ Starting full system update at $(date)" + + # Ensure sudo credentials are fresh + if ! sudo -vn 2>/dev/null; then + echo "πŸ”’ sudo authentication required..." + sudo -v + fi + + echo "🍎 Updating macOS Software..." + sudo softwareupdate -i -a + + echo "🍺 Updating Homebrew packages..." + brew update + brew upgrade + brew cleanup + brew autoremove + + # Mac App Store updates + echo "🍎 Updating Mac App Store apps..." + if command -v mas >/dev/null; then + local mas_outdated=$(mas outdated) + if [[ -n "$mas_outdated" ]]; then + echo "πŸ“± Updating MAS apps:" + echo "$mas_outdated" | while read -r line; do + echo " $line" + done + mas upgrade || echo "⚠️ Some MAS updates may require manual intervention" else - echo "❌ curl not available for weather lookup" + echo "βœ… All MAS apps are up to date" fi -} + else + echo "⚠️ mas not installed - install with: brew install mas" + fi -# PDF compression with quality options -pdfcompress() { - local input_file="$1" - local quality="${2:-screen}" # screen, ebook, printer, prepress - - if [[ ! -f "$input_file" ]]; then - echo "❌ File not found: $input_file" - return 1 - fi - - if ! command -v gs >/dev/null; then - echo "❌ Ghostscript not found. Install with: brew install ghostscript" - return 1 - fi - - local output_file="${input_file%.*}.compressed.pdf" - - gs -q -dNOPAUSE -dBATCH -dSAFER \ - -sDEVICE=pdfwrite \ - -dCompatibilityLevel=1.4 \ - -dPDFSETTINGS=/"$quality" \ - -dEmbedAllFonts=true \ - -dSubsetFonts=true \ - -sOutputFile="$output_file" \ - "$input_file" - - if [[ -f "$output_file" ]]; then - local original_size=$(du -h "$input_file" | cut -f1) - local compressed_size=$(du -h "$output_file" | cut -f1) - echo "βœ… Compressed: $original_size β†’ $compressed_size" - echo "πŸ“ Output: $output_file" + echo "πŸ”„ Refreshing fzf..." + if [ -d ~/.fzf ]; then + cd ~/.fzf && git pull && ./install --all && cd - + fi + + # Fix Zsh completion security warnings + echo "πŸ”’ Checking Zsh completion security..." + if [[ -d "/opt/homebrew/share/zsh" ]]; then + # Fix common Homebrew Zsh permission issues + chmod 755 /opt/homebrew/share/zsh /opt/homebrew/share/zsh/site-functions 2>/dev/null || true + fi + + echo "🧹 Checking for broken symlinks..." + find /usr/local/bin "$HOME/bin" "$HOME/.local/bin" -xtype l 2>/dev/null + + echo "πŸŒ“ Moon phase at update time:" + if command -v curl &>/dev/null && command -v jq >/dev/null; then + # Use API key from SwiftBar script + local api_key="6ec71a8170214d828c08ba8bf2ca29e9" + moon_json=$(curl -s "https://api.ipgeolocation.io/astronomy?apiKey=$api_key" 2>/dev/null) + if [[ $? -eq 0 ]] && [[ -n "$moon_json" ]]; then + moon_phase=$(echo "$moon_json" | jq -r '.moon_phase // "Unknown"' | tr '_' ' ') + illum=$(echo "$moon_json" | jq -r '.moon_illumination_percentage // "Unknown"') + # Add moon emoji based on phase + local moon_emoji="πŸŒ™" + case "$moon_phase" in + "new moon") moon_emoji="πŸŒ‘" ;; + "waxing crescent") moon_emoji="πŸŒ’" ;; + "first quarter") moon_emoji="πŸŒ“" ;; + "waxing gibbous") moon_emoji="πŸŒ”" ;; + "full moon") moon_emoji="πŸŒ•" ;; + "waning gibbous") moon_emoji="πŸŒ–" ;; + "last quarter") moon_emoji="πŸŒ—" ;; + "waning crescent") moon_emoji="🌘" ;; + esac + echo "$moon_emoji $moon_phase (${illum}%)" else - echo "❌ Compression failed" + echo "πŸŒ™ Moon phase unavailable" + fi + else + echo "πŸŒ™ Moon phase tracking disabled (missing curl or jq)" + fi + + if [ -d "$HOME/.dotfiles" ]; then + echo "πŸ“ Committing dotfile changes..." + cd ~/.dotfiles || return + git add . && git commit -m "πŸ”§ Auto-commit from sysupdate on $(date '+%Y-%m-%d %H:%M')" && git push + brew bundle dump --force --file="$HOME/.dotfiles/Brewfile" + cd - >/dev/null || return + fi + + echo "πŸ“Š System Info:" + echo "πŸ’» $(uname -a)" + echo "πŸ“… macOS: $(sw_vers | grep ProductVersion)" + echo "🧠 Memory: $(top -l 1 -s 0 | grep PhysMem)" + + # Optional post-update hook + if [ -x "$HOME/.zsh/hooks/post-update" ]; then + "$HOME/.zsh/hooks/post-update" + fi + + echo "πŸ•“ Duration: $(($(date +%s) - $start_time))s" + osascript -e 'display notification "Update complete!" with title "System Maintenance" subtitle "All systems go πŸš€"' +} + +# πŸ’€ Quiet version (no output, same functionality) +function quietupdate() { + local start_time=$(date +%s) + sudo -vn 2>/dev/null || sudo -v + sudo softwareupdate -i -a >/dev/null + brew update >/dev/null && brew upgrade >/dev/null && brew cleanup >/dev/null && brew autoremove >/dev/null + [ -d ~/.fzf ] && cd ~/.fzf && git pull >/dev/null && ./install --all >/dev/null && cd - >/dev/null + [ -d "$HOME/.dotfiles" ] && cd ~/.dotfiles && git add . && git commit -m "auto sysupdate" && git push && brew bundle dump --force --file="$HOME/.dotfiles/Brewfile" && cd - >/dev/null + if [ -x "$HOME/.zsh/hooks/post-update" ]; then "$HOME/.zsh/hooks/post-update"; fi + osascript -e 'display notification "Quiet update complete!" with title "System Maintenance"' +} + +## IV. Enhanced Man Page Viewer ####################### + +# Detect current terminal for optimal display +detect_terminal() { + if [[ -n "${KITTY_WINDOW_ID-}" ]]; then + echo "kitty" + elif [[ -n "${ITERM_SESSION_ID-}" ]] || [[ "$TERM_PROGRAM" == "iTerm.app" ]]; then + echo "iterm" + elif [[ "$TERM_PROGRAM" == "kitty" ]]; then + echo "kitty" + else + echo "unknown" + fi +} + +# Enhanced man function with beautiful formatting in new window +man() { + # If no arguments, show usage + if [[ $# -eq 0 ]]; then + echo "Usage: man [section]" + echo "Opens beautifully formatted man page in new terminal window" return 1 fi -} - -# Context-aware directory change with hooks -smart_cd() { - cd "$@" && detect_context - # Auto-activate virtual environments - if [[ -f "venv/bin/activate" ]]; then - echo "🐍 Virtual environment detected" + local cmd="$1" + local section="${2:-}" + local terminal_type=$(detect_terminal) + + # Check if man page exists + if ! command man -w ${section:+$section} "$cmd" >/dev/null 2>&1; then + echo "❌ No manual entry for '$cmd'${section:+ in section $section}" + return 1 fi - # Show git status in git repos - if [[ -d ".git" ]] && command -v git >/dev/null; then - echo "πŸ“Š $(git branch --show-current) | $(git status --porcelain | wc -l | tr -d ' ') changes" + # Build the command to run in new window + local man_cmd + if command -v bat >/dev/null; then + # Use bat for beautiful syntax highlighting with Nord theme + man_cmd="MANPAGER='bat --language=man --style=grid --color=always --theme=Nord' man ${section:+$section} '$cmd'" + else + # Fallback to enhanced less + man_cmd="MANPAGER='less -R' man ${section:+$section} '$cmd'" + fi + + # Terminal-specific window creation + case "$terminal_type" in + "kitty") + # Kitty: New window with optimal size for reading + kitty @ new-window --title "πŸ“– man $cmd${section:+ ($section)}" --cwd "$PWD" \ + zsh -c "$man_cmd; echo; echo 'πŸ“– Press any key to close...'; read -k1" + ;; + "iterm") + # iTerm2: New window with AppleScript + osascript -e " + tell application \"iTerm\" + create window with default profile + tell current session of current window + write text \"$man_cmd; echo; echo 'πŸ“– Press any key to close...'; read -k1\" + set name to \"πŸ“– man $cmd${section:+ ($section)}\" + end tell + end tell + " >/dev/null 2>&1 + ;; + *) + # Fallback: run in current terminal with nice formatting + echo "πŸ“– Displaying man page for '$cmd'${section:+ (section $section)}:" + echo "" + eval "$man_cmd" + ;; + esac +} + +# Quick man page search function +mans() { + if [[ $# -eq 0 ]]; then + echo "Usage: mans " + echo "Search for man pages containing the term" + return 1 + fi + + echo "πŸ” Searching man pages for: $*" + echo "" + + # Use apropos to search, format nicely + if command -v bat >/dev/null; then + apropos "$*" | bat --language=man --style=plain --theme=Nord + else + apropos "$*" fi } -# Override cd with smart_cd -alias cd='smart_cd' - -# Add context detection to prompt changes -chpwd_functions+=(detect_context) \ No newline at end of file diff --git a/shell/paths.zsh b/shell/paths.zsh index cf0bd09..992211b 100644 --- a/shell/paths.zsh +++ b/shell/paths.zsh @@ -5,7 +5,10 @@ # Intelligent PATH management with existence checking and deduplication # Ensure we have a clean slate for PATH manipulation -typeset -U path PATH # Remove duplicates automatically +# Remove duplicates automatically (zsh-specific) +if [[ -n "$ZSH_VERSION" ]]; then + typeset -U path PATH +fi # Define potential paths in priority order declare -a potential_paths=( diff --git a/ssh/config b/ssh/config new file mode 100644 index 0000000..2792db2 --- /dev/null +++ b/ssh/config @@ -0,0 +1,10 @@ +Host * + AddKeysToAgent yes + UseKeychain yes + IdentityFile ~/.ssh/dfg_GH + +Host github.com + HostName github.com + User git + IdentityFile ~/.ssh/dfg_GH + IdentitiesOnly yes