Skip to content

Instantly share code, notes, and snippets.

@gerwld
Last active September 4, 2025 00:47
Show Gist options
  • Save gerwld/ac6c3c361482768fb436327b5aab7b5f to your computer and use it in GitHub Desktop.
Save gerwld/ac6c3c361482768fb436327b5aab7b5f to your computer and use it in GitHub Desktop.
.zshrc config
export ZSH="$HOME/.oh-my-zsh"
ZSH_THEME="robbyrussell"
export PATH="/usr/local/opt/ruby/bin:$PATH"
#17 java
export JAVA_HOME=$(/usr/libexec/java_home -v 17)
# android paths
export ANDROID_HOME=$HOME/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator
export PATH=$PATH:$ANDROID_HOME/platform-tools
plugins=(git)
source $ZSH/oh-my-zsh.sh
# -- better trackpad scaling on > 2015 mac models. safe to use. -- #
# TO ENABLE IT:
# use with the first argument, for example:
# $ make_touchpad_great_again 5.3
# TO REVERT CHANGES:
# run with the `revert` key, example:
# $ make_touchpad_great_again revert
# or, provide the original value:
# $ make_touchpad_great_again 0.8321 (where 0.8321 is your original value)
make_touchpad_great_again() {
default_value=5
original_value=0.8321
# default value if $1 is invalid / not exists
value="${1:-$default_value}"
#throw "an exception" and break if none or wrong value was provided
if [ -z "$1" ] || { ! echo "$1" | grep -Eq '^[0-9]+(\.[0-9]+)?$' && [ "$1" != "revert" ]; }; then
if [ -z "$1" ]; then # if arg not provided
printf "\033[31m\nError: The first argument was not used.\033[0m\n\n"
else # if arg is wrong
printf "\033[31m\nError: The first provided argument is incorrect: $1. \nStopping the execution.\033[0m\n\n"
fi
printf "\\033[36mUsage example:\033[0m\n\t \033[90m $ tmake_touchpad_great_again your_scale_value\033[0m (from 0.2 to 10)\n\n\
\033[36mTo revert the changes:\033[0m\n\t \033[90m $ tmake_touchpad_great_again revert\033[0m\n\n\
\033[36mOr, if the original value was different than 0.8321:\033[0m\n\t \033[90m $ make_touchpad_great_again your_scale_value\033[0m (from 0.2 to 10)\n\n"
return 1
fi
#show echo new process
echo "\n \\033[90m- new process -\033[0m "
#check if first argument == "revert"
if [ "$value" = "revert" ]; then
orig_var=0.8321
echo "\n\033[36mReverting to the original value ($orig_var)... \033[0m \n\n\n\t(if the original value was different than $original_value then run: \033[90m \n\n\t\t $ make_touchpad_great_again your_value\033[0m\n"
defaults write -g com.apple.trackpad.scaling -float "$original_value"
#else - continue the changing process
else
#check if first arg is number
if echo "$value" | grep -Eq '^[0-9]+(\.[0-9]+)?$'; then
scaling="$value"
else
scaling="$default_value"
fi
#read the previous trackpad scaling
prev_var=$(defaults read -g com.apple.trackpad.scaling)
echo "\n\033[36mThe previous scaling for trackpad was: $prev_var\033[0m"
echo "\n\033[36mSetting up to $scaling...\033[0m"
defaults write -g com.apple.trackpad.scaling -float "$scaling"
fi
#restart macOS services to apply changes (>/dev/null 2>&1 to suppress not important logs)
killall SystemUIServer >/dev/null 2>&1
killall Finder >/dev/null 2>&1
killall Dock >/dev/null 2>&1
#read new trackpad scaling
new_var=$(defaults read -g com.apple.trackpad.scaling)
echo "\n\033[32mNew value was set to: $new_var\033[0m"
}
# nav to proj
seme() {
cd ~/Desktop/prog/projects/"$@"
}
# fastcommit
ftcommit() {
git add . && git commit -m "Updates"
}
ftpush() {
git push origin main
}
# fastdeploy
ftdeploy() {
pnpm run build && pnpm run deploy
}
laf() {
ftcommit
ftpush
}
gs() {
git status
}
# prevents opening 50 Finder windows & other apps on boot
disable_macos_boot_shitload () {
sudo chown root ~/Library/Preferences/ByHost/com.apple.loginwindow.*
sudo chmod 000 ~/Library/Preferences/ByHost/com.apple.loginwindow.*
sudo chown root ~/Library/Saved\ Application\ State/com.apple.finder.savedState
sudo chmod 000 ~/Library/Saved\ Application\ State/com.apple.finder.savedState
defaults write -g ApplePersistence -bool false
defaults write com.apple.loginwindow TALLogoutSavesState -bool false
}
# brings it back
enable_macos_boot_shitload () {
defaults write -g ApplePersistence -bool true
defaults write com.apple.loginwindow TALLogoutSavesState -bool true
sudo rm -rf ~/Library/Preferences/ByHost/com.apple.loginwindow.*
sudo rm -rf ~/Library/Saved\ Application\ State/com.apple.finder.savedState
}
# disables update iPhone iOS popup (macos)
disable_ios_update_popup(){
cd /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Resources/
sudo mv MobileDeviceUpdater.app MobileDeviceUpdaterDISABLED.app
}
# enables it back
enable_ios_update_popup(){
cd /Library/Apple/System/Library/PrivateFrameworks/MobileDevice.framework/Versions/A/Resources/
sudo mv MobileDeviceUpdaterDISABLED.app MobileDeviceUpdater.app
}
# fixes the iPhone USB cycle connected-disconnected-connected issue
fixiphone() {
sudo killall -STOP -c usbd
}
# shows mylocalip
getmyip() {
ifconfig | grep "inet " | grep -v 127.0.0.1 | cut -d\ -f2
}
# fixes node package manager perms
fixnpmpermissions() {
sudo chown -R $(whoami) ~/.npm
}
# No update
HOMEBREW_NO_AUTO_UPDATE="1"
# plugins
plugins=(git)
# pnpm
export PNPM_HOME="/Users/apple/Library/pnpm"
case ":$PATH:" in
*":$PNPM_HOME:"*) ;;
*) export PATH="$PNPM_HOME:$PATH" ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment