Skip to content

blueyi/my-utils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

225 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

My-Utils

One-click dev environment setup for Linux / macOS. Default shells: bash + zsh (Oh My Zsh); Fish is optional (see below). Also vimrc, tmux, etc.

Features

  • Linux (Ubuntu / Debian / Fedora) and macOS
  • Configs managed via symlinks; edits stay in repo for backup and version control
  • One-shot or selective install; --yes for non-interactive mode
  • Profile presets: C++, Python, AI Infra (LLVM / MLIR); optional Triton (GPU kernel) via config/triton.bash
  • One env file: config/resetrc.bash holds all shared env as # SECTION: … blocks (nvm, pyenv, CUDA, LLVM, …). Edit that file to affect bash, zsh, and profiles; optional Fish uses the same file via emit_fish_env.bash when linked.

Design: multi-OS, multi-shell, minimal host changes

What touches the system

  • Only $HOME (and standard XDG paths) are modified by default, via common/link.inicreate_links.sh: symlinks such as ~/.bashrc, ~/.zshrc, ~/.my-utils.env, ~/.shell_init.bash, etc. Fish symlinks are commented out in link.ini until you opt in.
  • Shell env logic lives entirely under the cloned repo (config/resetrc.bash, shell_init.bash, …). No /etc patches are required for this dotfiles layout.
  • common/misc.sh may run chsh to zsh after Oh My Zsh install—that does change the login shell in /etc/passwd (or equivalent). Remove or guard that block if you want zero account-level changes.

Multi-OS

Multi-shell

Gaps (by choice)

  • Login-only sessions that never source ~/.bashrc / ~/.zshrc won’t load my-utils unless you add a one-liner to ~/.profile or ~/.zprofile pointing at shell_init / resetrc—not linked by default to keep the installer conservative.

中文概要: 默认 packages 只装 zsh(含 Oh My Zsh 相关),不装 FishFish 相关 symlink 在 link.ini 里默认注释,需用时自行安装 fish 并取消注释后再跑 linksmiscchsh 可能把登录 shell 改为 zsh。

Quick Start

git clone https://github.com/your-user/my-utils.git ~/repos/my-utils
cd ~/repos/my-utils

# One-shot init (no prompts): packages, links, misc, vimrc, cursor
./bootstrap.sh --yes

# Interactive: asks which of (packages, links, misc, vimrc, cursor) to run
./bootstrap.sh

exec $SHELL

Install Options

# Without --yes: prompts for each step (packages / links / misc / vimrc / cursor)
./bootstrap.sh

# With --yes: run selected steps with no prompts
./bootstrap.sh --yes                              # all steps
./bootstrap.sh --tools packages --yes             # system packages only
./bootstrap.sh --tools links --yes                # symlinks only (vimrc, bashrc, zshrc, etc.)
./bootstrap.sh --tools misc --yes                 # oh-my-zsh, pyenv
./bootstrap.sh --tools vimrc --yes                # vim plugins
./bootstrap.sh --tools cursor --yes               # Cursor config backup link
./bootstrap.sh --tools packages links cursor --yes # multiple steps

Config Layout

~/.vimrc, ~/.bashrc, ~/.zshrc symlink to files under config/. ~/.p10k.zshconfig/p10k.zsh (Powerlevel10k; edit in repo, re-run links if needed). ~/.bashrc / ~/.zshrc end with source ~/.shell_init.bash, which runs config/shell_init.bash: zsh → Oh My Zsh + p10k + resetrc.bash; bash → interactive defaults + resetrc.bash. All shared env lives in config/resetrc.bash as ordered # SECTION: … blocks (proxy, PATH, nvm, pyenv, zsh-only OpenClaw/fzf, CUDA, LLVM, …). Zsh-only bits are guarded with ZSH_VERSION inside that file.

config/
├── _vimrc, _bashrc, _zshrc   → ~/.vimrc, ~/.bashrc, ~/.zshrc
├── p10k.zsh                  → ~/.p10k.zsh (Powerlevel10k theme)
├── shell_init.bash           → ~/.shell_init.bash
├── resetrc.bash              # monolithic env (comment sections; search SECTION:)
├── sections/README.md        # pointer only (old split layout archived in deprecated/)
├── bash_interactive.bash     # bash-only prompt, completion
├── zsh_entry.zsh             # Oh My Zsh + theme/plugins, then resetrc
├── path.bash, cmake_env.bash # thin → resetrc (IDE one-liners)
├── emit_fish_env.bash, fish/my-utils.fish  # optional Fish; symlink via commented lines in link.ini
├── triton.bash               # optional GPU/Triton layer on top of resetrc
├── deprecated/               # archive (see deprecated/README.md)
└── ...

Optional Fish

Not installed or linked by default. Steps: sudo apt install fish (or brew install fish) → uncomment the two Fish lines in common/link.ini./bootstrap.sh --tools links --yes. Then Fish loads my-utils.fish, which runs emit_fish_env.bash to mirror resetrc.bash + optional_home.bash exports. For pyenv in Fish, see pyenv init - fish upstream.

Profiles and optional env

# Preset profiles (manual source)
source ~/repos/my-utils/profiles/cpp/env.bash      # C++ / LLVM
source ~/repos/my-utils/profiles/python/env.bash   # Python
source ~/repos/my-utils/profiles/ai_infra/env.bash  # AI Infra

# Triton (GPU kernel) dev
source "$MYRC_PATH/triton.bash"

Troubleshooting

CMake: Ninja / C/C++ compiler not found

If you see:

  • CMake was unable to find a build program corresponding to "Ninja"
  • CMAKE_C_COMPILER not set / CMAKE_CXX_COMPILER not set

Quick fix (any terminal, including Cursor/IDE): source the CMake env script before running cmake so PATH, CC, CXX, and CMAKE_MAKE_PROGRAM are set:

# Replace with your actual my-utils path if different
source ~/workspace/my-utils/config/cmake_env.bash
# or, if MY_UTILS_ROOT is already set:
source "$MY_UTILS_ROOT/config/cmake_env.bash"

cd /path/to/your/project/build
cmake ..

macOS:

  1. PATH: Homebrew and baseline paths are set in config/resetrc.bash when you use the linked rc. If your terminal didn’t load it (e.g. Cursor’s built-in terminal), use the source .../config/cmake_env.bash one-liner above (it sources resetrc.bash).

  2. C/C++ compiler: Install Xcode Command Line Tools so clang is available:

    xcode-select --install
    

Linux (apt): Install packages with ./bootstrap.sh --tools packages --yes. If the terminal didn’t load your rc, run source .../config/cmake_env.bash before cmake.

Env RC encrypted backup (repo-external)

my-utils now includes env backup helpers compatible with the sync-config skill's .env.rc encryption format, but with a safer default: encrypted output lives outside the repo.

Unified command:

  • tools/env_sync/env_sync.py

Legacy helper scripts still exist for now, but the recommended entrypoint is the single unified command above.

Default encrypted backup path:

~/.local/state/my-utils/env.rc.enc

Typical usage:

export SYNC_ENV_KEY="your-secure-key-here"

# Encrypt ~/.env.rc to repo-external backup file
python3 tools/env_sync/env_sync.py encrypt

# Decrypt to stdout or a temp file
python3 tools/env_sync/env_sync.py decrypt --output /tmp/env.rc.backup

# Compare / merge (keep local values, add missing keys from backup)
python3 tools/env_sync/env_sync.py merge --local ~/.env.rc --backup /tmp/env.rc.backup --dry-run

Notes:

  • Format is intentionally compatible with workspace/skills/sync-config/scripts/{encrypt,decrypt,merge}_env.py
  • The encrypted artifact is not stored in this repo by default
  • SYNC_ENV_KEY is required and should stay in your local shell env / ~/.env.rc

Cursor Config Backup

Sync Cursor settings to cursor_bak/ and use symlinks so edits stay in the repo. Backed up (macOS: ~/Library/Application Support/Cursor, Linux: ~/.config/Cursor):

  • User/ – settings.json, keybindings.json, mcp.json, snippets, etc.
  • Preferences – app-level preferences file
  • ide_state.json – when present
  • ~/.cursor/rulescursor_bak/rules
  • ~/.cursor/projectscursor_bak/projects (per-workspace state; terminals/ and agent-transcripts/ are gitignored)

Included in default tool list (both ./bootstrap.sh --yes and interactive ./bootstrap.sh will include cursor unless you use --tools to limit):

./bootstrap.sh --yes                    # runs cursor step with others
./bootstrap.sh --tools cursor --yes     # only Cursor config link
./bootstrap.sh --tools cursor          # interactive: ask then link
# Standalone:
./common/cursor_config_link.sh          # Link
./common/cursor_config_link.sh --restore   # Restore original paths

License

MIT

About

Some useful script for config linux system

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors