Skip to content

Instantly share code, notes, and snippets.

View dhb52's full-sized avatar

dhb52 dhb52

  • China
View GitHub Profile
@dhb52
dhb52 / ustc-brew-origin.md
Created April 20, 2019 13:19
中科大brew源

中科大brew源

git -C "/usr/local/Homebrew" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

恢复官方源

git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew.git
@dhb52
dhb52 / ustc-brew-origin.md
Created April 20, 2019 13:19
中科大brew源

中科大brew源

git -C "/usr/local/Homebrew" remote set-url origin https://mirrors.ustc.edu.cn/brew.git
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
git -C "/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

恢复官方源

git -C "/usr/local/Homebrew" remote set-url origin https://github.com/Homebrew/brew.git
@dhb52
dhb52 / centos-yum-source-aliyun.md
Created April 8, 2019 08:03
change centos yum source to aliyun

备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

下载新的CentOS-Base.repo 到/etc/yum.repos.d/

CentOS 5

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
@dhb52
dhb52 / headless-vm-osx.md
Created April 2, 2019 14:18
How to run “headless” virtual machines in OS X

Parallels Desktop

Quit Parallels Desktop, if it’s open Open the Terminal utility Get a list of the current configured VMs:

prlctl list -a
# Note the name of the VM you want to start, and then start it:
prlctl start "VM NAME"
@dhb52
dhb52 / macos-ssh-lclocale-warning.md
Last active August 29, 2019 10:44
macOS ssh LC warning

解决 Mac Os X 升级之后出现 LC_CTYPE 警告问题 Mac 升级到 10.14 之后,登录远程 linux 服务器会出现如下错误:

warning: setlocale: LC_CTYPE: cannot change locale (UTF-8): No such file or directory

由于 mac ssh 连接的时候传递了 LANG 环境变量,此变量与服务器变量不一致,导致该问题发生。

解决方法,取消传递 LANG 环境变量:

@dhb52
dhb52 / docker-linux-alias.sh
Last active April 2, 2019 06:39
docker alias
alias drun='sudo docker run'
alias dps='sudo docker ps'
alias drm='sudo docker rm'
alias drmi='sudo docker rmi'
alias dim='sudo docker images'
alias dexec='sudo docker exec'
alias dpull='sudo docker pull'
alias dins='sudo docker inspect'

cp pub key on to server using scp

on server

mkdir ~/.ssh
chmod 700 ~/.ssh

on client

scp -p ~/.ssh/id_rsa.pub <user>@centos:/home/<user>/.ssh/authorized_keys
@dhb52
dhb52 / nuxt_baidu_hm.js
Created March 7, 2019 15:20
nuxtjs baidu hm
if (process.BROWSER_BUILD && process.env.NODE_ENV === 'production') {
var _hmt = _hmt || [];
(function() {
var hm = document.createElement("script");
hm.src = "https://hm.baidu.com/hm.js?xxxx";
hm.id = "baidu_tj";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(hm, s);
})();
}
  echo "diffing $*"
  $HOME/bin/excel_cmp/bin/excel_cmp "$1" "$2"
  exit 0
  • Configure [git config] (file://)