Skip to content

Instantly share code, notes, and snippets.

View SmileMachine's full-sized avatar
🏠
Working from home

SmileMachine

🏠
Working from home
View GitHub Profile
@SmileMachine
SmileMachine / README.md
Last active March 3, 2026 01:16
Copy remote(ssh) text to local clipboard (like macOS pbcopy).

pbcopy

Copy text to your local clipboard over SSH, just like macOS's built-in pbcopy.

echo "hello" | pbcopy
cat file.txt | pbcopy
pbcopy "some text"
@SmileMachine
SmileMachine / git-sync.sh
Created February 24, 2026 12:24
专为个人开发者 Monorepo/Worktree 打造的 Git 智能同步脚本:支持固定开发分支的循环复用,构建整洁的线性“气泡”历史。
#!/bin/bash
# ==============================================================================
# 🚀 git-sync: Git Worktree 智能同步脚本 (个人开发者 Monorepo 专用版)
# ==============================================================================
#
# 【脚本用途】
# 本脚本专为“个人开发者”量身打造,旨在简化 Monorepo 环境下的本地开发流。
# 不同于团队协作中的“一功能一分支”模式,本脚本鼓励为每个 Worktree 使用“固定
# 开发分支”(如 ios-dev)。通过自动化合并与重置,实现分支的循环复用。
import plistlib # 读取 plist 文件
import subprocess # 执行命令
def get_default_opener(ext):
# 获取当前的打开方式
result = subprocess.run(['duti', '-x', ext], capture_output=True, text=True)
if result.returncode != 0:
print(result.stderr)
return None
@SmileMachine
SmileMachine / install-omz.sh
Last active November 21, 2025 21:44
Install Oh My Zsh and some useful plugins on a new machine.
#!/bin/bash
# !!! This script is used specially for first install of omz on a new machine
# !!! All configurations in .zshrc will be replaced !!! (A backup file will be created)
set -euo pipefail
# Terminal colors
RED='\033[0;31m'
GREEN='\033[0;32m'