From d612f10ed9be272413ceb84354710c4ba89c1a7f Mon Sep 17 00:00:00 2001 From: Luk Date: Tue, 16 Apr 2024 12:16:34 +0800 Subject: [PATCH] u --- geth-install.sh | 2 +- mac-accelerate-backup.sh | 9 +++++++++ mac-config.sh | 2 +- mac-homebrew-install.sh | 20 ++++++++++++++++++-- nixhome/.bashrc | 32 ++++++++++++++++++++++---------- proxy.sh | 6 +++--- 6 files changed, 54 insertions(+), 17 deletions(-) create mode 100644 mac-accelerate-backup.sh diff --git a/geth-install.sh b/geth-install.sh index 1058ec2..c698195 100755 --- a/geth-install.sh +++ b/geth-install.sh @@ -20,7 +20,7 @@ then # 用 dpkg --print-architecture 更直接 ARCH=`dpkg --print-architecture` else - if [ "$(uname -m)" = "aarch64" ] + if [ "$(uname -m)" = "aarch64" ] || [ "$(uname -m)" = "arm64" ] # on MacBook Air M2, $(uname -m) returns 'arm64' then ARCH=arm64 elif [ "$(uname -m)" = "armv7l" ] diff --git a/mac-accelerate-backup.sh b/mac-accelerate-backup.sh new file mode 100644 index 0000000..9c007bd --- /dev/null +++ b/mac-accelerate-backup.sh @@ -0,0 +1,9 @@ +# https://blog.csdn.net/fuxin123123/article/details/122288466 +# Mac TimeMachine 全速备份 +# 如果你的 Mac 是第一次备份,一般都很慢,可以调节参数的方式将其调节为全速进行备份,记得备份完后将其调整回来,否则可能会导致你的电脑在正常使用的时候由于同时在备份导致卡顿。 +# 打开终端,执行如下命令开启全速备份: +# 测试发现,对通过 Finder 备份 iPhone 也有效 +sudo sysctl debug.lowpri_throttle_enabled=0 + +# 关闭全速备份: +sudo sysctl debug.lowpri_throttle_enabled=1 diff --git a/mac-config.sh b/mac-config.sh index bcf3b9b..dcd8832 100755 --- a/mac-config.sh +++ b/mac-config.sh @@ -1,6 +1,6 @@ defaults write com.apple.dock springboard-rows -int 9 -defaults write com.apple.dock springboard-columns -int 12 +defaults write com.apple.dock springboard-columns -int 15 defaults write com.apple.dock ResetLaunchPad -bool true diff --git a/mac-homebrew-install.sh b/mac-homebrew-install.sh index 6e6d649..5e0e226 100644 --- a/mac-homebrew-install.sh +++ b/mac-homebrew-install.sh @@ -1,5 +1,21 @@ +# install: https://docs.brew.sh/Installation +# 用 *.pkg 安装的效果和命令行其实一样 echo "Installing Homebrew on MacOS" -/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" +/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" +# default brew path: /opt/homebrew for Apple Silicon, /usr/local/Homebrew for macOS Intel and /home/linuxbrew/.linuxbrew for Linux +# add brew to path: +# (echo; echo 'eval "$(/opt/homebrew/bin/brew shellenv)"') >> /Users/luk/.bash_profile +# eval "$(/opt/homebrew/bin/brew shellenv)" +# +# export HOMEBREW_PREFIX="/opt/homebrew"; +# export HOMEBREW_CELLAR="/opt/homebrew/Cellar"; +# export HOMEBREW_REPOSITORY="/opt/homebrew"; +# export PATH="/opt/homebrew/bin:/opt/homebrew/sbin${PATH+:$PATH}"; +# export MANPATH="/opt/homebrew/share/man${MANPATH+:$MANPATH}:"; +# export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}"; +# -# uninstall: /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)" + +# uninstall: https://github.com/homebrew/install#uninstall-homebrew +# /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)" # install emacs: brew cask install emacs diff --git a/nixhome/.bashrc b/nixhome/.bashrc index 630ae7d..ac6ca0a 100644 --- a/nixhome/.bashrc +++ b/nixhome/.bashrc @@ -77,7 +77,7 @@ umask 022 # rwxr-xr-x # PROMPT_COMMAND is expanded only when used. case "$TERM" in xterm*|rxvt*) - PROMPT_COMMAND='echo -ne "\033]0;<${USER}@${HOSTNAME}::${PWD}>B\007"' + PROMPT_COMMAND='echo -ne "\033]0;<${USER}@${HOSTNAME}:${PWD}>B\007"' ;; dumb*) ;; @@ -130,6 +130,17 @@ xterm*|rxvt*) esac ############## above settings copied from amazon's debian #################### +if [ "$(uname)" = "Darwin" ] +then + if [ "$(uname -m)" = "arm64" ] && [ -f /opt/homebrew/bin/brew ] + then + eval "$(/opt/homebrew/bin/brew shellenv)" + elif [ "$(uname -m)" = "x86_64" ] && [ -f /usr/local/homebrew/bin/brew ] + then + eval "$(/usr/local/homebrew/bin/brew shellenv)" + fi +fi + # nvm settings if [ -d $HOME/.nvm ] then @@ -139,6 +150,12 @@ then [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion fi +# fnm settings +# if [ $(which fnm) ] +# then +# eval "$(fnm env --use-on-cd)" +# fi + # acme.sh settings if [ -f $HOME/.acme.sh/acme.sh.env ] then @@ -150,15 +167,10 @@ fi export USERPROFILE=$HOME # # add sysconfig to path -# tp1=/faronear/sysconfig -# tp2=~/sysconfig -# if [ -d $tp1 ] -# then -# export PATH=$tp1:$PATH -# elif [ -d $tp2 ] -# then -# export PATH=$tp2:$PATH -# fi +if [ -e ~/sysconfig ] +then + export PATH=~/sysconfig:$PATH +fi if [ -f ~/.bashrc_custom ] then diff --git a/proxy.sh b/proxy.sh index 7462554..6d236c5 100755 --- a/proxy.sh +++ b/proxy.sh @@ -9,9 +9,9 @@ fi # function proxy() { if [ "$proxySwitch" == "s" ] || [ "$proxySwitch" == "1" ]; then - export all_proxy=socks5://127.0.0.1:1086 - export http_proxy=socks5://127.0.0.1:1086 - export https_proxy=socks5://127.0.0.1:1086 + export all_proxy=socks5://127.0.0.1:7898 + export http_proxy=socks5://127.0.0.1:7898 + export https_proxy=socks5://127.0.0.1:7898 echo -e "--- 已开启网络代理" elif [ "$proxySwitch" == "t" ] || [ "$proxySwitch" == "0" ]; then unset all_proxy