Last active
November 12, 2025 09:56
-
-
Save chunheisiu/b3e6f88d930db44cbd77627053233816 to your computer and use it in GitHub Desktop.
Useful shell scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Useful shell scripts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pandoc_md2html.sh <input filename> <output filename> <output file title> | |
| pandoc $1 \ | |
| --output=$2 \ | |
| --from=gfm \ | |
| --to=html5 \ | |
| --css=$HOME/git/markdown-css/github.css \ | |
| --self-contained \ | |
| --metadata=title:$3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # pandoc_md2pdf.sh <input filename> <output filename> <output file title> | |
| pandoc $1 \ | |
| -V geometry:margin=0.5in \ | |
| -V mainfont=Arial \ | |
| --output=$2 \ | |
| --from=gfm \ | |
| --to=latex \ | |
| --self-contained \ | |
| --pdf-engine=xelatex \ | |
| --metadata=title:$3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # "$(brew --repository)/Library/Taps/homebrew/homebrew-cask/"" | |
| /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
| brew install brew-cask-completion | |
| brew tap buo/cask-upgrade | |
| brew tap Homebrew/cask-drivers | |
| brew install apparency qlstephen qlcolorcode | |
| xattr -d -r com.apple.quarantine ~/Library/QuickLook |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| RED="\033[1;91m" | |
| WHITE="\033[1;97m" | |
| ENDCOLOR="\033[0m" | |
| # Brew | |
| echo "${RED}##${ENDCOLOR} ${WHITE}Update Brew${ENDCOLOR}" | |
| brew update | |
| brew upgrade | |
| brew cu -a | |
| brew cleanup | |
| echo | |
| # Replace App Icons | |
| echo "${RED}##${ENDCOLOR} ${WHITE}Update App Icons${ENDCOLOR}" | |
| read -p "Update app icons [y/N]? " update_icons | |
| if [[ "$update_icons" =~ ^[Yy]$ ]]; then | |
| . ${0%/*}/update_app_icons.sh | |
| fi | |
| echo | |
| # Conda | |
| echo "${RED}##${ENDCOLOR} ${WHITE}Update Conda${ENDCOLOR}" | |
| conda update --all |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| APPLICATIONS_DIR="/Applications/" | |
| ICONS_DIR="/Users/chunheisiu/Documents/Icons/" | |
| APPS=( | |
| # "Dark Mode for Safari" | |
| "Days Matter" | |
| # "Futubull" | |
| "GIMP" | |
| "JetBrains Toolbox" | |
| # "Spotify" | |
| "uSMART Trade" | |
| "Zerotier" | |
| ) | |
| for app in "${APPS[@]}"; do | |
| app_path="${APPLICATIONS_DIR}${app}.app" | |
| icon_path="${ICONS_DIR}${app}.icns" | |
| fileicon set "${app_path}" "${icon_path}" -q | |
| # Retry using sudo if the first attempt fails | |
| if [ $? -ne 0 ]; then | |
| sudo fileicon set "${app_path}" "${icon_path}" -q | |
| fi | |
| echo "Updated icon for ${app}.app with ${app}.icns" | |
| done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment